all: remove old uuid

Change-Id: I3a137f73456f010c37d3933dbe12cbbb840b809f
This commit is contained in:
Egon Elbre 2020-04-02 17:18:08 +03:00
parent e725535873
commit 6492b13d81
28 changed files with 117 additions and 121 deletions

View File

@ -114,7 +114,7 @@ func TestObserver_processSegment(t *testing.T) {
var ( var (
bucketName = "test-bucket" bucketName = "test-bucket"
projectID = testrand.UUID2() projectID = testrand.UUID()
numSegments = 65 numSegments = 65
obsvr = observer{ obsvr = observer{
objects: make(bucketsObjects), objects: make(bucketsObjects),
@ -155,7 +155,7 @@ func TestObserver_processSegment(t *testing.T) {
var ( var (
bucketName = "test-bucket" bucketName = "test-bucket"
projectID = testrand.UUID2() projectID = testrand.UUID()
numSegments = 65 numSegments = 65
obsvr = observer{ obsvr = observer{
objects: make(bucketsObjects), objects: make(bucketsObjects),
@ -223,7 +223,7 @@ func TestObserver_processSegment(t *testing.T) {
to = time.Now() to = time.Now()
from = to.Add(-time.Hour) from = to.Add(-time.Hour)
bucketName = "test-bucket" bucketName = "test-bucket"
projectID = testrand.UUID2() projectID = testrand.UUID()
obsvr = observer{ obsvr = observer{
objects: make(bucketsObjects), objects: make(bucketsObjects),
from: &from, from: &from,
@ -262,7 +262,7 @@ func TestObserver_processSegment(t *testing.T) {
from = to.Add(-2 * time.Hour) from = to.Add(-2 * time.Hour)
diffFromTo = to.Sub(from) diffFromTo = to.Sub(from)
bucketName = "test-bucket" bucketName = "test-bucket"
projectID = testrand.UUID2() projectID = testrand.UUID()
numSegmentsObjOutDateRange = rand.Intn(50) + 15 numSegmentsObjOutDateRange = rand.Intn(50) + 15
numSegmentsBeforeDate = rand.Intn(numSegmentsObjOutDateRange-1) + 1 numSegmentsBeforeDate = rand.Intn(numSegmentsObjOutDateRange-1) + 1
obsvr = observer{ obsvr = observer{
@ -342,7 +342,7 @@ func TestObserver_processSegment(t *testing.T) {
to = time.Now() to = time.Now()
from = to.Add(-time.Hour) from = to.Add(-time.Hour)
bucketName = "test-bucket" bucketName = "test-bucket"
projectID = testrand.UUID2() projectID = testrand.UUID()
obsvr = observer{ obsvr = observer{
objects: make(bucketsObjects), objects: make(bucketsObjects),
from: &from, from: &from,
@ -381,7 +381,7 @@ func TestObserver_processSegment(t *testing.T) {
from = to.Add(-2 * time.Hour) from = to.Add(-2 * time.Hour)
diffFromTo = to.Sub(from) diffFromTo = to.Sub(from)
bucketName = "test-bucket" bucketName = "test-bucket"
projectID = testrand.UUID2() projectID = testrand.UUID()
numSegmentsObjOutDateRange = rand.Intn(50) + 15 numSegmentsObjOutDateRange = rand.Intn(50) + 15
numSegmentsBeforeDate = rand.Intn(numSegmentsObjOutDateRange-1) + 1 numSegmentsBeforeDate = rand.Intn(numSegmentsObjOutDateRange-1) + 1
obsvr = observer{ obsvr = observer{
@ -499,7 +499,7 @@ func TestObserver_processSegment_from_to(t *testing.T) {
to: to, to: to,
} }
path := metainfo.ScopedPath{ path := metainfo.ScopedPath{
ProjectID: testrand.UUID2(), ProjectID: testrand.UUID(),
Segment: "l", Segment: "l",
BucketName: "bucket1", BucketName: "bucket1",
EncryptedObjectPath: "path1", EncryptedObjectPath: "path1",
@ -570,7 +570,7 @@ func TestObserver_processSegment_single_project(t *testing.T) {
expected string expected string
} }
project1 := testrand.UUID2().String() project1 := testrand.UUID().String()
tests := []struct { tests := []struct {
objects []object objects []object
}{ }{
@ -725,7 +725,7 @@ func TestObserver_analyzeProject(t *testing.T) {
observer := &observer{ observer := &observer{
objects: bucketObjects, objects: bucketObjects,
lastProjectID: testrand.UUID2().String(), lastProjectID: testrand.UUID().String(),
zombieBuffer: make([]int, 0, maxNumOfSegments), zombieBuffer: make([]int, 0, maxNumOfSegments),
} }
err := observer.findZombieSegments(object) err := observer.findZombieSegments(object)
@ -768,7 +768,7 @@ func createNewObjectSegments(
t.Helper() t.Helper()
var ( var (
objectID = testrand.UUID2().String() objectID = testrand.UUID().String()
projectIDString = projectID.String() projectIDString = projectID.String()
references = make([]segmentRef, 0, numSegments) references = make([]segmentRef, 0, numSegments)
encryptedPath = fmt.Sprintf("%s-%s-%s", projectIDString, bucketName, objectID) encryptedPath = fmt.Sprintf("%s-%s-%s", projectIDString, bucketName, objectID)
@ -864,7 +864,7 @@ func generateTestdataObjects(
} }
bucketName = "0" bucketName = "0"
numObjs = rand.Intn(10) + 2 numObjs = rand.Intn(10) + 2
projID = testrand.UUID2() projID = testrand.UUID()
withoutLastSegmentCount = 0 withoutLastSegmentCount = 0
withMoreThanMaxNumSegmentsCount = 0 withMoreThanMaxNumSegmentsCount = 0
numMaxGeneratedSegments = 10 numMaxGeneratedSegments = 10

4
go.mod
View File

@ -43,10 +43,10 @@ require (
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 golang.org/x/time v0.0.0-20191024005414-555d28b269f0
google.golang.org/grpc v1.28.0 google.golang.org/grpc v1.28.0
storj.io/common v0.0.0-20200401122855-4ad28fd2218f storj.io/common v0.0.0-20200402141439-ea355ebf34e9
storj.io/drpc v0.0.11 storj.io/drpc v0.0.11
storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b
storj.io/uplink v1.0.3 storj.io/uplink v1.0.4-0.20200402121754-b505de28b00e
// storj/gatway for storj-sim is installed via makefile `install-sim` target // storj/gatway for storj-sim is installed via makefile `install-sim` target
) )

11
go.sum
View File

@ -620,17 +620,14 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d h1:R4qel+wubcKJP8HvWromOGOplbAlpVNwfIkDkFD4RY0= storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d h1:R4qel+wubcKJP8HvWromOGOplbAlpVNwfIkDkFD4RY0=
storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d/go.mod h1:I0QTs7z1rI+ZEN95GGY2LKMzP5OZqu0Udga3WhyQfO0= storj.io/common v0.0.0-20200323134045-2bd4d6e2dd7d/go.mod h1:I0QTs7z1rI+ZEN95GGY2LKMzP5OZqu0Udga3WhyQfO0=
storj.io/common v0.0.0-20200331095257-30ebbdbbba88/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE=
storj.io/common v0.0.0-20200331124657-a4f8265946f2 h1:Fctei5lPPAfbvtpijLQZTjQeeuh+MCkacLYau7nyxKA= storj.io/common v0.0.0-20200331124657-a4f8265946f2 h1:Fctei5lPPAfbvtpijLQZTjQeeuh+MCkacLYau7nyxKA=
storj.io/common v0.0.0-20200331124657-a4f8265946f2/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE= storj.io/common v0.0.0-20200331124657-a4f8265946f2/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE=
storj.io/common v0.0.0-20200401095230-4fe9b2ad3ec0 h1:gFsVck24e/eU3j9qmfXwsyBUwvtcjuTD5JXvvv9NdFE= storj.io/common v0.0.0-20200402141439-ea355ebf34e9 h1:f/QpTOgCXhoZ4es+Pm0l2TKnvC6FbwuUtD62sVBAhag=
storj.io/common v0.0.0-20200401095230-4fe9b2ad3ec0/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE= storj.io/common v0.0.0-20200402141439-ea355ebf34e9/go.mod h1:pZyXiIE7bGETIRXtfs0nICqMwp7PM8HqnDuyUeldNA0=
storj.io/common v0.0.0-20200401122855-4ad28fd2218f h1:17QhsiCE8PFKoVaxRk+8tfGazlm2r5mMsXEtFTT2F9w=
storj.io/common v0.0.0-20200401122855-4ad28fd2218f/go.mod h1:RBaNRmk/lqyZ7h1MAH4N9zld0z+tO4M9sLOFT30K+cE=
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ= storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ=
storj.io/drpc v0.0.11 h1:6vLxfpSbwCLtqzAoXzXx/SxBqBtbzbmquXPqfcWKqfw= storj.io/drpc v0.0.11 h1:6vLxfpSbwCLtqzAoXzXx/SxBqBtbzbmquXPqfcWKqfw=
storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw= storj.io/drpc v0.0.11/go.mod h1:TiFc2obNjL9/3isMW1Rpxjy8V9uE0B2HMeMFGiiI7Iw=
storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b h1:loru+Vg+FdSxGIajoLUl2JRo4rDk6kPwU4PXN89nHvM= storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b h1:loru+Vg+FdSxGIajoLUl2JRo4rDk6kPwU4PXN89nHvM=
storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b/go.mod h1:I09FR2ZU1Dy1vaQ2SkUbfGpwVtJrwafjYWGw8W808WE= storj.io/private v0.0.0-20200327035409-e9d82e7e0c6b/go.mod h1:I09FR2ZU1Dy1vaQ2SkUbfGpwVtJrwafjYWGw8W808WE=
storj.io/uplink v1.0.3 h1:n2l9zQb5gfgq6HrJ3MTAq/l2FvJSdqp/0jx6HiHnsO8= storj.io/uplink v1.0.4-0.20200402121754-b505de28b00e h1:6q1z5uBzKttqLR6s8ObQT4Ok6n5xASDZzjTiVf/6FfQ=
storj.io/uplink v1.0.3/go.mod h1:pYQNAsuV6zwnTinYlu7lm/BSl/SqevNksmki5oPgJ0g= storj.io/uplink v1.0.4-0.20200402121754-b505de28b00e/go.mod h1:emdQZ1n7/YUPRhuk8XznZaQeV5fVkBTJTOImq4af76c=

View File

@ -69,7 +69,7 @@ func TestBucket_PartnerAttribution(t *testing.T) {
apikey, err := uplink.ParseAPIKey(planet.Uplinks[0].APIKey[satellite.ID()].Serialize()) apikey, err := uplink.ParseAPIKey(planet.Uplinks[0].APIKey[satellite.ID()].Serialize())
require.NoError(t, err) require.NoError(t, err)
partnerID := testrand.UUID2() partnerID := testrand.UUID()
t.Run("without partner id", func(t *testing.T) { t.Run("without partner id", func(t *testing.T) {
config := uplink.Config{} config := uplink.Config{}
@ -120,7 +120,7 @@ func TestBucket_PartnerAttribution(t *testing.T) {
config := uplink.Config{} config := uplink.Config{}
config.Volatile.Log = zaptest.NewLogger(t) config.Volatile.Log = zaptest.NewLogger(t)
config.Volatile.TLS.SkipPeerCAWhitelist = true config.Volatile.TLS.SkipPeerCAWhitelist = true
config.Volatile.PartnerID = testrand.UUID2().String() config.Volatile.PartnerID = testrand.UUID().String()
up, err := uplink.NewUplink(ctx, &config) up, err := uplink.NewUplink(ctx, &config)
require.NoError(t, err) require.NoError(t, err)
@ -202,7 +202,7 @@ func TestBucket_UserAgent(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
partnerID, err := uuid.FromString("8cd605fa-ad00-45b6-823e-550eddc611d6") partnerID, err := uuid.FromString("8cd605fa-ad00-45b6-823e-550eddc611d6")
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, partnerID, uuid.UUID(bucketInfo.PartnerID)) assert.Equal(t, partnerID, bucketInfo.PartnerID)
}) })
t.Run("open with different user agent", func(t *testing.T) { t.Run("open with different user agent", func(t *testing.T) {
@ -227,7 +227,7 @@ func TestBucket_UserAgent(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
partnerID, err := uuid.FromString("8cd605fa-ad00-45b6-823e-550eddc611d6") partnerID, err := uuid.FromString("8cd605fa-ad00-45b6-823e-550eddc611d6")
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, partnerID, uuid.UUID(bucketInfo.PartnerID)) assert.Equal(t, partnerID, bucketInfo.PartnerID)
}) })
}) })
} }

View File

@ -106,7 +106,7 @@ func (p *Project) CreateBucket(ctx context.Context, name string, cfg *BucketConf
} }
bucket = storj.Bucket{ bucket = storj.Bucket{
PartnerID: storj.DeprecatedUUID(partnerID), PartnerID: partnerID,
PathCipher: cfg.PathCipher, PathCipher: cfg.PathCipher,
DefaultEncryptionParameters: cfg.EncryptionParameters, DefaultEncryptionParameters: cfg.EncryptionParameters,
DefaultRedundancyScheme: cfg.Volatile.RedundancyScheme, DefaultRedundancyScheme: cfg.Volatile.RedundancyScheme,
@ -239,6 +239,6 @@ func (p *Project) trySetBucketAttribution(ctx context.Context, bucketName string
// UserAgent is sent via RequestHeader // UserAgent is sent via RequestHeader
return p.metainfo.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ return p.metainfo.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{
Bucket: bucketName, Bucket: bucketName,
PartnerID: storj.DeprecatedUUID(partnerID), PartnerID: partnerID,
}) })
} }

View File

@ -79,7 +79,7 @@ func (planet *Planet) newReferralManager() (*server.Server, error) {
func (server *DefaultReferralManagerServer) GetTokens(ctx context.Context, req *pb.GetTokensRequest) (*pb.GetTokensResponse, error) { func (server *DefaultReferralManagerServer) GetTokens(ctx context.Context, req *pb.GetTokensRequest) (*pb.GetTokensResponse, error) {
tokens := make([][]byte, server.tokenCount) tokens := make([][]byte, server.tokenCount)
for i := 0; i < server.tokenCount; i++ { for i := 0; i < server.tokenCount; i++ {
uuid := testrand.UUID2() uuid := testrand.UUID()
tokens[i] = uuid[:] tokens[i] = uuid[:]
} }
return &pb.GetTokensResponse{ return &pb.GetTokensResponse{

View File

@ -26,7 +26,7 @@ import (
func TestSaveBucketTallies(t *testing.T) { func TestSaveBucketTallies(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
// Setup: create bucket storage tallies // Setup: create bucket storage tallies
projectID := testrand.UUID2() projectID := testrand.UUID()
bucketTallies, expectedTallies, err := createBucketStorageTallies(projectID) bucketTallies, expectedTallies, err := createBucketStorageTallies(projectID)
require.NoError(t, err) require.NoError(t, err)
@ -136,7 +136,7 @@ func TestStorageNodeUsage(t *testing.T) {
func TestProjectLimits(t *testing.T) { func TestProjectLimits(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
proj, err := db.Console().Projects().Insert(ctx, &console.Project{Name: "test", OwnerID: testrand.UUID2()}) proj, err := db.Console().Projects().Insert(ctx, &console.Project{Name: "test", OwnerID: testrand.UUID()})
require.NoError(t, err) require.NoError(t, err)
err = db.ProjectAccounting().UpdateProjectUsageLimit(ctx, proj.ID, 1) err = db.ProjectAccounting().UpdateProjectUsageLimit(ctx, proj.ID, 1)

View File

@ -85,7 +85,7 @@ func TestRedisCacheConcurrency(t *testing.T) {
cache, err := live.NewCache(zaptest.NewLogger(t).Named("live-accounting"), config) cache, err := live.NewCache(zaptest.NewLogger(t).Named("live-accounting"), config)
require.NoError(t, err) require.NoError(t, err)
projectID := testrand.UUID2() projectID := testrand.UUID()
const ( const (
numConcurrent = 100 numConcurrent = 100
@ -123,7 +123,7 @@ func populateCache(ctx context.Context, cache accounting.Cache) (projectIDs []uu
// make up some project IDs // make up some project IDs
projectIDs = make([]uuid.UUID, numProjects) projectIDs = make([]uuid.UUID, numProjects)
for i := range projectIDs { for i := range projectIDs {
projectIDs[i] = testrand.UUID2() projectIDs[i] = testrand.UUID()
} }
// send lots of space used updates for all of these projects to the live // send lots of space used updates for all of these projects to the live
@ -179,7 +179,7 @@ func TestGetAllProjectTotals(t *testing.T) {
projectIDs := make([]uuid.UUID, 1000) projectIDs := make([]uuid.UUID, 1000)
for i := range projectIDs { for i := range projectIDs {
projectIDs[i] = testrand.UUID2() projectIDs[i] = testrand.UUID()
err := cache.AddProjectStorageUsage(ctx, projectIDs[i], int64(i)) err := cache.AddProjectStorageUsage(ctx, projectIDs[i], int64(i))
require.NoError(t, err) require.NoError(t, err)
} }

View File

@ -208,7 +208,7 @@ func createBucketBandwidthRollupsForPast4Days(ctx *testcontext.Context, satellit
func TestProjectBandwidthTotal(t *testing.T) { func TestProjectBandwidthTotal(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
pdb := db.ProjectAccounting() pdb := db.ProjectAccounting()
projectID := testrand.UUID2() projectID := testrand.UUID()
// Setup: create bucket bandwidth rollup records // Setup: create bucket bandwidth rollup records
expectedTotal, err := createBucketBandwidthRollupsForPast4Days(ctx, db, projectID) expectedTotal, err := createBucketBandwidthRollupsForPast4Days(ctx, db, projectID)
@ -290,8 +290,8 @@ func TestUsageRollups(t *testing.T) {
now := time.Now() now := time.Now()
start := now.Add(tallyInterval * time.Duration(-tallyIntervals)) start := now.Add(tallyInterval * time.Duration(-tallyIntervals))
project1 := testrand.UUID2() project1 := testrand.UUID()
project2 := testrand.UUID2() project2 := testrand.UUID()
p1base := binary.BigEndian.Uint64(project1[:8]) >> 48 p1base := binary.BigEndian.Uint64(project1[:8]) >> 48
p2base := binary.BigEndian.Uint64(project2[:8]) >> 48 p2base := binary.BigEndian.Uint64(project2[:8]) >> 48

View File

@ -63,8 +63,8 @@ func (testData *AttributionTestData) init() {
func TestDB(t *testing.T) { func TestDB(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
attributionDB := db.Attribution() attributionDB := db.Attribution()
project1, project2 := testrand.UUID2(), testrand.UUID2() project1, project2 := testrand.UUID(), testrand.UUID()
partner1, partner2 := testrand.UUID2(), testrand.UUID2() partner1, partner2 := testrand.UUID(), testrand.UUID()
infos := []*attribution.Info{ infos := []*attribution.Info{
{project1, []byte("alpha"), partner1, time.Time{}}, {project1, []byte("alpha"), partner1, time.Time{}},
@ -93,14 +93,14 @@ func TestQueryAttribution(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
now := time.Now() now := time.Now()
projectID := testrand.UUID2() projectID := testrand.UUID()
partnerID := testrand.UUID2() partnerID := testrand.UUID()
alphaBucket := []byte("alpha") alphaBucket := []byte("alpha")
betaBucket := []byte("beta") betaBucket := []byte("beta")
testData := []AttributionTestData{ testData := []AttributionTestData{
{ {
name: "new partnerID, projectID, alpha", name: "new partnerID, projectID, alpha",
partnerID: testrand.UUID2(), partnerID: testrand.UUID(),
projectID: projectID, projectID: projectID,
bucketName: alphaBucket, bucketName: alphaBucket,
@ -115,7 +115,7 @@ func TestQueryAttribution(t *testing.T) {
{ {
name: "partnerID, new projectID, alpha", name: "partnerID, new projectID, alpha",
partnerID: partnerID, partnerID: partnerID,
projectID: testrand.UUID2(), projectID: testrand.UUID(),
bucketName: alphaBucket, bucketName: alphaBucket,
remoteSize: remoteSize / 2, remoteSize: remoteSize / 2,
@ -128,7 +128,7 @@ func TestQueryAttribution(t *testing.T) {
}, },
{ {
name: "new partnerID, projectID, beta", name: "new partnerID, projectID, beta",
partnerID: testrand.UUID2(), partnerID: testrand.UUID(),
projectID: projectID, projectID: projectID,
bucketName: betaBucket, bucketName: betaBucket,
@ -143,7 +143,7 @@ func TestQueryAttribution(t *testing.T) {
{ {
name: "partnerID, new projectID, beta", name: "partnerID, new projectID, beta",
partnerID: partnerID, partnerID: partnerID,
projectID: testrand.UUID2(), projectID: testrand.UUID(),
bucketName: betaBucket, bucketName: betaBucket,
remoteSize: remoteSize / 4, remoteSize: remoteSize / 4,

View File

@ -13,7 +13,7 @@ import (
) )
func TestClaims(t *testing.T) { func TestClaims(t *testing.T) {
id := testrand.UUID2() id := testrand.UUID()
claims := Claims{ claims := Claims{
ID: id, ID: id,

View File

@ -26,7 +26,7 @@ func TestProjectMembersRepository(t *testing.T) {
createdUsers, createdProjects := prepareUsersAndProjects(ctx, t, users, projects) createdUsers, createdProjects := prepareUsersAndProjects(ctx, t, users, projects)
t.Run("Can't insert projectMember without memberID", func(t *testing.T) { t.Run("Can't insert projectMember without memberID", func(t *testing.T) {
missingUserID := testrand.UUID2() missingUserID := testrand.UUID()
projMember, err := projectMembers.Insert(ctx, missingUserID, createdProjects[0].ID) projMember, err := projectMembers.Insert(ctx, missingUserID, createdProjects[0].ID)
assert.Nil(t, projMember) assert.Nil(t, projMember)
@ -34,7 +34,7 @@ func TestProjectMembersRepository(t *testing.T) {
}) })
t.Run("Can't insert projectMember without projectID", func(t *testing.T) { t.Run("Can't insert projectMember without projectID", func(t *testing.T) {
missingProjectID := testrand.UUID2() missingProjectID := testrand.UUID()
projMember, err := projectMembers.Insert(ctx, createdUsers[0].ID, missingProjectID) projMember, err := projectMembers.Insert(ctx, createdUsers[0].ID, missingProjectID)
assert.Nil(t, projMember) assert.Nil(t, projMember)
@ -156,37 +156,37 @@ func TestProjectMembersRepository(t *testing.T) {
func prepareUsersAndProjects(ctx context.Context, t *testing.T, users console.Users, projects console.Projects) ([]*console.User, []*console.Project) { func prepareUsersAndProjects(ctx context.Context, t *testing.T, users console.Users, projects console.Projects) ([]*console.User, []*console.Project) {
usersList := []*console.User{{ usersList := []*console.User{{
ID: testrand.UUID2(), ID: testrand.UUID(),
Email: "2email2@mail.test", Email: "2email2@mail.test",
PasswordHash: []byte("some_readable_hash"), PasswordHash: []byte("some_readable_hash"),
ShortName: "Liam", ShortName: "Liam",
FullName: "Liam Jameson", FullName: "Liam Jameson",
}, { }, {
ID: testrand.UUID2(), ID: testrand.UUID(),
Email: "1email1@mail.test", Email: "1email1@mail.test",
PasswordHash: []byte("some_readable_hash"), PasswordHash: []byte("some_readable_hash"),
ShortName: "William", ShortName: "William",
FullName: "Noahson William", FullName: "Noahson William",
}, { }, {
ID: testrand.UUID2(), ID: testrand.UUID(),
Email: "email3@mail.test", Email: "email3@mail.test",
PasswordHash: []byte("some_readable_hash"), PasswordHash: []byte("some_readable_hash"),
ShortName: "Mason", ShortName: "Mason",
FullName: "Mason Elijahson", FullName: "Mason Elijahson",
}, { }, {
ID: testrand.UUID2(), ID: testrand.UUID(),
Email: "email4@mail.test", Email: "email4@mail.test",
PasswordHash: []byte("some_readable_hash"), PasswordHash: []byte("some_readable_hash"),
ShortName: "Oliver", ShortName: "Oliver",
FullName: "Oliver Jacobson", FullName: "Oliver Jacobson",
}, { }, {
ID: testrand.UUID2(), ID: testrand.UUID(),
Email: "email5@mail.test", Email: "email5@mail.test",
PasswordHash: []byte("some_readable_hash"), PasswordHash: []byte("some_readable_hash"),
ShortName: "Lucas", ShortName: "Lucas",
FullName: "Michaelson Lucas", FullName: "Michaelson Lucas",
}, { }, {
ID: testrand.UUID2(), ID: testrand.UUID(),
Email: "email6@mail.test", Email: "email6@mail.test",
PasswordHash: []byte("some_readable_hash"), PasswordHash: []byte("some_readable_hash"),
ShortName: "Alexander", ShortName: "Alexander",

View File

@ -44,7 +44,7 @@ func TestProjectsRepository(t *testing.T) {
t.Run("Insert project successfully", func(t *testing.T) { t.Run("Insert project successfully", func(t *testing.T) {
var err error var err error
owner, err = users.Insert(ctx, &console.User{ owner, err = users.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: userFullName, FullName: userFullName,
ShortName: shortName, ShortName: shortName,
Email: email, Email: email,
@ -53,7 +53,7 @@ func TestProjectsRepository(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, owner) require.NotNil(t, owner)
owner, err := users.Insert(ctx, &console.User{ owner, err := users.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: userFullName, FullName: userFullName,
ShortName: shortName, ShortName: shortName,
Email: email, Email: email,
@ -178,7 +178,7 @@ func TestProjectsList(t *testing.T) {
// create owner // create owner
owner, err := db.Console().Users().Insert(ctx, owner, err := db.Console().Users().Insert(ctx,
&console.User{ &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "Billy H", FullName: "Billy H",
Email: "billyh@example.com", Email: "billyh@example.com",
PasswordHash: []byte("example_password"), PasswordHash: []byte("example_password"),

View File

@ -35,7 +35,7 @@ func TestNewRegistrationSecret(t *testing.T) {
t.Run("Insert reset password token successfully", func(t *testing.T) { t.Run("Insert reset password token successfully", func(t *testing.T) {
var err error var err error
owner, err = users.Insert(ctx, &console.User{ owner, err = users.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: userFullName, FullName: userFullName,
ShortName: shortName, ShortName: shortName,
Email: email, Email: email,

View File

@ -25,7 +25,7 @@ func TestUserCredits(t *testing.T) {
consoleDB := db.Console() consoleDB := db.Console()
user, referrer, activeOffer, defaultOffer := setupData(ctx, t, db) user, referrer, activeOffer, defaultOffer := setupData(ctx, t, db)
randomID := testrand.UUID2() randomID := testrand.UUID()
invalidOffer := rewards.Offer{ invalidOffer := rewards.Offer{
ID: 10, ID: 10,
} }
@ -290,7 +290,7 @@ func setupData(ctx context.Context, t *testing.T, db satellite.DB) (user *consol
// create an user // create an user
user, err = consoleDB.Users().Insert(ctx, &console.User{ user, err = consoleDB.Users().Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "John Doe", FullName: "John Doe",
Email: "john@mail.test", Email: "john@mail.test",
PasswordHash: userPassHash, PasswordHash: userPassHash,
@ -300,7 +300,7 @@ func setupData(ctx context.Context, t *testing.T, db satellite.DB) (user *consol
//create an user as referrer //create an user as referrer
referrer, err = consoleDB.Users().Insert(ctx, &console.User{ referrer, err = consoleDB.Users().Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "referrer", FullName: "referrer",
Email: "referrer@mail.test", Email: "referrer@mail.test",
PasswordHash: referrerPassHash, PasswordHash: referrerPassHash,

View File

@ -32,11 +32,11 @@ const (
func TestUserRepository(t *testing.T) { func TestUserRepository(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
repository := db.Console().Users() repository := db.Console().Users()
partnerID := testrand.UUID2() partnerID := testrand.UUID()
// Test with and without partnerID // Test with and without partnerID
user := &console.User{ user := &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: name, FullName: name,
ShortName: lastName, ShortName: lastName,
Email: email, Email: email,
@ -47,7 +47,7 @@ func TestUserRepository(t *testing.T) {
testUsers(ctx, t, repository, user) testUsers(ctx, t, repository, user)
user = &console.User{ user = &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: name, FullName: name,
ShortName: lastName, ShortName: lastName,
Email: email, Email: email,
@ -72,7 +72,7 @@ func TestUserEmailCase(t *testing.T) {
{email: "_______@domain.com "}, {email: "_______@domain.com "},
} { } {
newUser := &console.User{ newUser := &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: newName, FullName: newName,
ShortName: newLastName, ShortName: newLastName,
Email: testCase.email, Email: testCase.email,

View File

@ -32,7 +32,7 @@ func TestResolvePartnerID(t *testing.T) {
_, err = endpoint.ResolvePartnerID(ctx, &pb.RequestHeader{}, []byte{1, 2, 3}) _, err = endpoint.ResolvePartnerID(ctx, &pb.RequestHeader{}, []byte{1, 2, 3})
require.Error(t, err) require.Error(t, err)
randomUUID := testrand.UUID2() randomUUID := testrand.UUID()
// good uuid // good uuid
result, err := endpoint.ResolvePartnerID(ctx, &pb.RequestHeader{}, randomUUID[:]) result, err := endpoint.ResolvePartnerID(ctx, &pb.RequestHeader{}, randomUUID[:])

View File

@ -20,9 +20,9 @@ import (
func newTestBucket(name string, projectID uuid.UUID) storj.Bucket { func newTestBucket(name string, projectID uuid.UUID) storj.Bucket {
return storj.Bucket{ return storj.Bucket{
ID: storj.DeprecatedUUID(testrand.UUID2()), ID: testrand.UUID(),
Name: name, Name: name,
ProjectID: storj.DeprecatedUUID(projectID), ProjectID: projectID,
PathCipher: storj.EncAESGCM, PathCipher: storj.EncAESGCM,
DefaultSegmentsSize: 65536, DefaultSegmentsSize: 65536,
DefaultRedundancyScheme: storj.RedundancyScheme{ DefaultRedundancyScheme: storj.RedundancyScheme{

View File

@ -893,7 +893,7 @@ func (endpoint *Endpoint) setBucketAttribution(ctx context.Context, header *pb.R
} }
// update bucket information // update bucket information
bucket.PartnerID = storj.DeprecatedUUID(partnerID) bucket.PartnerID = partnerID
_, err = endpoint.metainfo.UpdateBucket(ctx, bucket) _, err = endpoint.metainfo.UpdateBucket(ctx, bucket)
if err != nil { if err != nil {
endpoint.log.Error("error while updating bucket", zap.ByteString("bucketName", bucketName), zap.Error(err)) endpoint.log.Error("error while updating bucket", zap.ByteString("bucketName", bucketName), zap.Error(err))
@ -934,10 +934,10 @@ func convertProtoToBucket(req *pb.BucketCreateRequest, projectID uuid.UUID) (buc
} }
return storj.Bucket{ return storj.Bucket{
ID: storj.DeprecatedUUID(bucketID), ID: bucketID,
Name: string(req.GetName()), Name: string(req.GetName()),
ProjectID: storj.DeprecatedUUID(projectID), ProjectID: projectID,
PartnerID: storj.DeprecatedUUID(partnerID), PartnerID: partnerID,
PathCipher: storj.CipherSuite(req.GetPathCipher()), PathCipher: storj.CipherSuite(req.GetPathCipher()),
DefaultSegmentsSize: req.GetDefaultSegmentSize(), DefaultSegmentsSize: req.GetDefaultSegmentSize(),
DefaultRedundancyScheme: storj.RedundancyScheme{ DefaultRedundancyScheme: storj.RedundancyScheme{

View File

@ -280,11 +280,11 @@ func TestSetBucketAttribution(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
defer ctx.Check(metainfoClient.Close) defer ctx.Check(metainfoClient.Close)
partnerID := testrand.UUID2() partnerID := testrand.UUID()
{ // bucket with no items { // bucket with no items
err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{
Bucket: "alpha", Bucket: "alpha",
PartnerID: storj.DeprecatedUUID(partnerID), PartnerID: partnerID,
}) })
require.NoError(t, err) require.NoError(t, err)
} }
@ -292,7 +292,7 @@ func TestSetBucketAttribution(t *testing.T) {
{ // setting attribution on a bucket that doesn't exist should fail { // setting attribution on a bucket that doesn't exist should fail
err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{
Bucket: "beta", Bucket: "beta",
PartnerID: storj.DeprecatedUUID(partnerID), PartnerID: partnerID,
}) })
require.Error(t, err) require.Error(t, err)
} }
@ -304,7 +304,7 @@ func TestSetBucketAttribution(t *testing.T) {
// trying to set attribution should be ignored // trying to set attribution should be ignored
err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{
Bucket: "alpha", Bucket: "alpha",
PartnerID: storj.DeprecatedUUID(partnerID), PartnerID: partnerID,
}) })
require.NoError(t, err) require.NoError(t, err)
} }
@ -316,7 +316,7 @@ func TestSetBucketAttribution(t *testing.T) {
// bucket with items // bucket with items
err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{ err = metainfoClient.SetBucketAttribution(ctx, metainfo.SetBucketAttributionParams{
Bucket: "alpha-new", Bucket: "alpha-new",
PartnerID: storj.DeprecatedUUID(partnerID), PartnerID: partnerID,
}) })
require.Error(t, err) require.Error(t, err)
} }
@ -499,7 +499,7 @@ func TestBeginCommitListSegment(t *testing.T) {
bucket := storj.Bucket{ bucket := storj.Bucket{
Name: "initial-bucket", Name: "initial-bucket",
ProjectID: storj.DeprecatedUUID(projectID), ProjectID: projectID,
PathCipher: config.GetEncryptionParameters().CipherSuite, PathCipher: config.GetEncryptionParameters().CipherSuite,
} }
_, err = metainfoService.CreateBucket(ctx, bucket) _, err = metainfoService.CreateBucket(ctx, bucket)
@ -694,7 +694,7 @@ func TestInlineSegment(t *testing.T) {
bucket := storj.Bucket{ bucket := storj.Bucket{
Name: "inline-segments-bucket", Name: "inline-segments-bucket",
ProjectID: storj.DeprecatedUUID(projectID), ProjectID: projectID,
PathCipher: config.GetEncryptionParameters().CipherSuite, PathCipher: config.GetEncryptionParameters().CipherSuite,
} }
_, err = metainfoService.CreateBucket(ctx, bucket) _, err = metainfoService.CreateBucket(ctx, bucket)

View File

@ -42,7 +42,7 @@ func TestRollupsWriteCacheBatchLimitReached(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
useBatchSize := 10 useBatchSize := 10
amount := (memory.MB * 500).Int64() amount := (memory.MB * 500).Int64()
projectID := testrand.UUID2() projectID := testrand.UUID()
startTime := time.Now() startTime := time.Now()
rwc := orders.NewRollupsWriteCache(zaptest.NewLogger(t), db.Orders(), useBatchSize) rwc := orders.NewRollupsWriteCache(zaptest.NewLogger(t), db.Orders(), useBatchSize)
@ -89,7 +89,7 @@ func TestRollupsWriteCacheBatchChore(t *testing.T) {
func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) { func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
useBatchSize := 10 useBatchSize := 10
amount := (memory.MB * 500).Int64() amount := (memory.MB * 500).Int64()
projectID := testrand.UUID2() projectID := testrand.UUID()
startTime := time.Now() startTime := time.Now()
planet.Satellites[0].Orders.Chore.Loop.Pause() planet.Satellites[0].Orders.Chore.Loop.Pause()
@ -145,7 +145,7 @@ func TestUpdateBucketBandwidthAllocation(t *testing.T) {
require.Equal(t, size, 0) require.Equal(t, size, 0)
// setup: add one item to the cache // setup: add one item to the cache
projectID := testrand.UUID2() projectID := testrand.UUID()
bucketName := []byte("testbucketname") bucketName := []byte("testbucketname")
amount := (memory.MB * 500).Int64() amount := (memory.MB * 500).Int64()
err := ordersDB.UpdateBucketBandwidthAllocation(ctx, projectID, bucketName, pb.PieceAction_GET, amount, time.Now()) err := ordersDB.UpdateBucketBandwidthAllocation(ctx, projectID, bucketName, pb.PieceAction_GET, amount, time.Now())
@ -169,7 +169,7 @@ func TestUpdateBucketBandwidthAllocation(t *testing.T) {
require.Equal(t, projectMap, expected) require.Equal(t, projectMap, expected)
// setup: add another item to the cache but with a different projectID // setup: add another item to the cache but with a different projectID
projectID2 := testrand.UUID2() projectID2 := testrand.UUID()
amount2 := (memory.MB * 10).Int64() amount2 := (memory.MB * 10).Int64()
err = ordersDB.UpdateBucketBandwidthAllocation(ctx, projectID2, bucketName, pb.PieceAction_GET, amount2, time.Now()) err = ordersDB.UpdateBucketBandwidthAllocation(ctx, projectID2, bucketName, pb.PieceAction_GET, amount2, time.Now())
require.NoError(t, err) require.NoError(t, err)

View File

@ -28,8 +28,8 @@ func TestCouponRepository(t *testing.T) {
Amount: 10, Amount: 10,
Status: payments.CouponActive, Status: payments.CouponActive,
Description: "description", Description: "description",
ProjectID: testrand.UUID2(), ProjectID: testrand.UUID(),
UserID: testrand.UUID2(), UserID: testrand.UUID(),
} }
now := time.Now().UTC() now := time.Now().UTC()
@ -112,7 +112,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// activated user with 2 project. New coupon should be added to the first project. // activated user with 2 project. New coupon should be added to the first project.
user1, err := usersRepo.Insert(ctx, &console.User{ user1, err := usersRepo.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "user1", FullName: "user1",
ShortName: "", ShortName: "",
Email: "test1@example.com", Email: "test1@example.com",
@ -127,7 +127,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// activated user with proj. New coupon should be added. // activated user with proj. New coupon should be added.
user2, err := usersRepo.Insert(ctx, &console.User{ user2, err := usersRepo.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "user2", FullName: "user2",
ShortName: "", ShortName: "",
Email: "test2@example.com", Email: "test2@example.com",
@ -142,7 +142,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// activated user without proj. New coupon should not be added. // activated user without proj. New coupon should not be added.
user3, err := usersRepo.Insert(ctx, &console.User{ user3, err := usersRepo.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "user3", FullName: "user3",
ShortName: "", ShortName: "",
Email: "test3@example.com", Email: "test3@example.com",
@ -157,7 +157,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// inactive user. New coupon should not be added. // inactive user. New coupon should not be added.
user4, err := usersRepo.Insert(ctx, &console.User{ user4, err := usersRepo.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "user4", FullName: "user4",
ShortName: "", ShortName: "",
Email: "test4@example.com", Email: "test4@example.com",
@ -167,7 +167,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// activated user with proj and coupon. New coupon should not be added. // activated user with proj and coupon. New coupon should not be added.
user5, err := usersRepo.Insert(ctx, &console.User{ user5, err := usersRepo.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "user5", FullName: "user5",
ShortName: "", ShortName: "",
Email: "test5@example.com", Email: "test5@example.com",
@ -182,7 +182,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// creating projects for users above. // creating projects for users above.
proj1, err := projectsRepo.Insert(ctx, &console.Project{ proj1, err := projectsRepo.Insert(ctx, &console.Project{
ID: testrand.UUID2(), ID: testrand.UUID(),
Name: "proj 1 of user 1", Name: "proj 1 of user 1",
Description: "descr 1", Description: "descr 1",
OwnerID: user1.ID, OwnerID: user1.ID,
@ -191,7 +191,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// should not be processed as we takes only first project of the user. // should not be processed as we takes only first project of the user.
proj2, err := projectsRepo.Insert(ctx, &console.Project{ proj2, err := projectsRepo.Insert(ctx, &console.Project{
ID: testrand.UUID2(), ID: testrand.UUID(),
Name: "proj 2 of user 1", Name: "proj 2 of user 1",
Description: "descr 2", Description: "descr 2",
OwnerID: user1.ID, OwnerID: user1.ID,
@ -199,7 +199,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
proj3, err := projectsRepo.Insert(ctx, &console.Project{ proj3, err := projectsRepo.Insert(ctx, &console.Project{
ID: testrand.UUID2(), ID: testrand.UUID(),
Name: "proj 1 of user 2", Name: "proj 1 of user 2",
Description: "descr 3", Description: "descr 3",
OwnerID: user2.ID, OwnerID: user2.ID,
@ -207,14 +207,14 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
proj4, err := projectsRepo.Insert(ctx, &console.Project{ proj4, err := projectsRepo.Insert(ctx, &console.Project{
ID: testrand.UUID2(), ID: testrand.UUID(),
Name: "proj 1 of user 5", Name: "proj 1 of user 5",
Description: "descr 4", Description: "descr 4",
OwnerID: user5.ID, OwnerID: user5.ID,
}) })
require.NoError(t, err) require.NoError(t, err)
couponID := testrand.UUID2() couponID := testrand.UUID()
err = couponsRepo.Insert(ctx, payments.Coupon{ err = couponsRepo.Insert(ctx, payments.Coupon{
ID: couponID, ID: couponID,
UserID: user5.ID, UserID: user5.ID,
@ -229,7 +229,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
// creating new users and projects to test that multiple execution of populate method wont generate extra coupons. // creating new users and projects to test that multiple execution of populate method wont generate extra coupons.
user6, err := usersRepo.Insert(ctx, &console.User{ user6, err := usersRepo.Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "user6", FullName: "user6",
ShortName: "", ShortName: "",
Email: "test6@example.com", Email: "test6@example.com",
@ -243,7 +243,7 @@ func TestPopulatePromotionalCoupons(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
proj5, err := projectsRepo.Insert(ctx, &console.Project{ proj5, err := projectsRepo.Insert(ctx, &console.Project{
ID: testrand.UUID2(), ID: testrand.UUID(),
Name: "proj 1 of user 6", Name: "proj 1 of user 6",
Description: "descr 6", Description: "descr 6",
OwnerID: user6.ID, OwnerID: user6.ID,

View File

@ -24,7 +24,7 @@ import (
func TestCreditsRepository(t *testing.T) { func TestCreditsRepository(t *testing.T) {
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
creditsRepo := db.StripeCoinPayments().Credits() creditsRepo := db.StripeCoinPayments().Credits()
userID := testrand.UUID2() userID := testrand.UUID()
credit := payments.Credit{ credit := payments.Credit{
UserID: userID, UserID: userID,
Amount: 10, Amount: 10,
@ -32,7 +32,7 @@ func TestCreditsRepository(t *testing.T) {
} }
spending := stripecoinpayments.CreditsSpending{ spending := stripecoinpayments.CreditsSpending{
ProjectID: testrand.UUID2(), ProjectID: testrand.UUID(),
UserID: userID, UserID: userID,
Amount: 5, Amount: 5,
Status: stripecoinpayments.CreditsSpendingStatusUnapplied, Status: stripecoinpayments.CreditsSpendingStatusUnapplied,

View File

@ -34,7 +34,7 @@ func TestServiceSuccess(t *testing.T) {
satellite := planet.Satellites[0] satellite := planet.Satellites[0]
userID := testrand.UUID2() userID := testrand.UUID()
tokens, err := satellite.API.Referrals.Service.GetTokens(ctx, &userID) tokens, err := satellite.API.Referrals.Service.GetTokens(ctx, &userID)
require.NoError(t, err) require.NoError(t, err)
require.Len(t, tokens, tokenCount) require.Len(t, tokens, tokenCount)
@ -44,7 +44,7 @@ func TestServiceSuccess(t *testing.T) {
ShortName: "test", ShortName: "test",
Email: "test@mail.test", Email: "test@mail.test",
Password: "123a123", Password: "123a123",
ReferralToken: testrand.UUID2().String(), ReferralToken: testrand.UUID().String(),
} }
createdUser, err := satellite.API.Referrals.Service.CreateUser(ctx, user) createdUser, err := satellite.API.Referrals.Service.CreateUser(ctx, user)
@ -74,7 +74,7 @@ func TestServiceRedeemFailure(t *testing.T) {
ShortName: "test", ShortName: "test",
Email: "test@mail.test", Email: "test@mail.test",
Password: "123a123", Password: "123a123",
ReferralToken: testrand.UUID2().String(), ReferralToken: testrand.UUID().String(),
} }
_, err := satellite.API.Referrals.Service.CreateUser(ctx, user) _, err := satellite.API.Referrals.Service.CreateUser(ctx, user)
require.Error(t, err) require.Error(t, err)

View File

@ -37,7 +37,7 @@ func TestIdentifyInjuredSegments(t *testing.T) {
ErasureShareSize: int32(256), ErasureShareSize: int32(256),
} }
projectID := testrand.UUID2() projectID := testrand.UUID()
pointerPathPrefix := storj.JoinPaths(projectID.String(), "l", "bucket") + "/" pointerPathPrefix := storj.JoinPaths(projectID.String(), "l", "bucket") + "/"
// add some valid pointers // add some valid pointers
@ -100,7 +100,7 @@ func TestIdentifyIrreparableSegments(t *testing.T) {
expectedLostPieces[int32(i)] = true expectedLostPieces[int32(i)] = true
} }
projectID := testrand.UUID2() projectID := testrand.UUID()
pointerPath := storj.JoinPaths(projectID.String(), "l", "bucket", "piece") pointerPath := storj.JoinPaths(projectID.String(), "l", "bucket", "piece")
pieceID := testrand.PieceID() pieceID := testrand.PieceID()

View File

@ -12,7 +12,6 @@ import (
"storj.io/common/storj" "storj.io/common/storj"
"storj.io/common/testcontext" "storj.io/common/testcontext"
"storj.io/common/testrand" "storj.io/common/testrand"
"storj.io/common/uuid"
"storj.io/storj/satellite" "storj.io/storj/satellite"
"storj.io/storj/satellite/console" "storj.io/storj/satellite/console"
"storj.io/storj/satellite/satellitedb/satellitedbtest" "storj.io/storj/satellite/satellitedb/satellitedbtest"
@ -27,18 +26,18 @@ func TestUsers(t *testing.T) {
// create an user with partnerID // create an user with partnerID
_, err := consoleDB.Users().Insert(ctx, &console.User{ _, err := consoleDB.Users().Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "John Doe", FullName: "John Doe",
Email: "john@mail.test", Email: "john@mail.test",
PasswordHash: userPassHash, PasswordHash: userPassHash,
Status: console.Active, Status: console.Active,
PartnerID: testrand.UUID2(), PartnerID: testrand.UUID(),
}) })
require.NoError(t, err) require.NoError(t, err)
// create an user with no partnerID // create an user with no partnerID
_, err = consoleDB.Users().Insert(ctx, &console.User{ _, err = consoleDB.Users().Insert(ctx, &console.User{
ID: testrand.UUID2(), ID: testrand.UUID(),
FullName: "John Doe", FullName: "John Doe",
Email: "john@mail.test", Email: "john@mail.test",
PasswordHash: userPassHash, PasswordHash: userPassHash,
@ -48,17 +47,17 @@ func TestUsers(t *testing.T) {
// create a project with partnerID // create a project with partnerID
_, err = consoleDB.Projects().Insert(ctx, &console.Project{ _, err = consoleDB.Projects().Insert(ctx, &console.Project{
ID: testrand.UUID2(), ID: testrand.UUID(),
Name: "John Doe", Name: "John Doe",
Description: "some description", Description: "some description",
PartnerID: testrand.UUID2(), PartnerID: testrand.UUID(),
CreatedAt: time.Now(), CreatedAt: time.Now(),
}) })
require.NoError(t, err) require.NoError(t, err)
// create a project with no partnerID // create a project with no partnerID
proj, err := consoleDB.Projects().Insert(ctx, &console.Project{ proj, err := consoleDB.Projects().Insert(ctx, &console.Project{
ID: testrand.UUID2(), ID: testrand.UUID(),
Name: "John Doe", Name: "John Doe",
Description: "some description", Description: "some description",
CreatedAt: time.Now(), CreatedAt: time.Now(),
@ -67,7 +66,7 @@ func TestUsers(t *testing.T) {
// create a APIKey with no partnerID // create a APIKey with no partnerID
_, err = consoleDB.APIKeys().Create(ctx, testrand.Bytes(8), console.APIKeyInfo{ _, err = consoleDB.APIKeys().Create(ctx, testrand.Bytes(8), console.APIKeyInfo{
ID: testrand.UUID2(), ID: testrand.UUID(),
ProjectID: proj.ID, ProjectID: proj.ID,
Name: "John Doe", Name: "John Doe",
Secret: []byte("xyz"), Secret: []byte("xyz"),
@ -77,9 +76,9 @@ func TestUsers(t *testing.T) {
// create a bucket with no partnerID // create a bucket with no partnerID
_, err = db.Buckets().CreateBucket(ctx, storj.Bucket{ _, err = db.Buckets().CreateBucket(ctx, storj.Bucket{
ID: storj.DeprecatedUUID(testrand.UUID2()), ID: testrand.UUID(),
Name: "testbucket", Name: "testbucket",
ProjectID: storj.DeprecatedUUID(proj.ID), ProjectID: proj.ID,
Created: time.Now(), Created: time.Now(),
PathCipher: storj.EncAESGCM, PathCipher: storj.EncAESGCM,
DefaultSegmentsSize: int64(100), DefaultSegmentsSize: int64(100),
@ -88,10 +87,10 @@ func TestUsers(t *testing.T) {
// update a bucket with partnerID // update a bucket with partnerID
bucket, err := db.Buckets().UpdateBucket(ctx, storj.Bucket{ bucket, err := db.Buckets().UpdateBucket(ctx, storj.Bucket{
ID: storj.DeprecatedUUID(testrand.UUID2()), ID: testrand.UUID(),
Name: "testbucket", Name: "testbucket",
ProjectID: storj.DeprecatedUUID(proj.ID), ProjectID: proj.ID,
PartnerID: storj.DeprecatedUUID(proj.ID), PartnerID: proj.ID,
Created: time.Now(), Created: time.Now(),
PathCipher: storj.EncAESGCM, PathCipher: storj.EncAESGCM,
DefaultSegmentsSize: int64(100), DefaultSegmentsSize: int64(100),
@ -99,7 +98,7 @@ func TestUsers(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
bucket, err = db.Buckets().GetBucket(ctx, []byte("testbucket"), proj.ID) bucket, err = db.Buckets().GetBucket(ctx, []byte("testbucket"), proj.ID)
require.NoError(t, err) require.NoError(t, err)
flag := uuid.UUID(bucket.PartnerID) == proj.ID
require.True(t, flag) require.Equal(t, proj.ID, bucket.PartnerID)
}) })
} }

View File

@ -200,9 +200,9 @@ func convertDBXtoBucket(dbxBucket *dbx.BucketMetainfo) (bucket storj.Bucket, err
} }
bucket = storj.Bucket{ bucket = storj.Bucket{
ID: storj.DeprecatedUUID(id), ID: id,
Name: string(dbxBucket.Name), Name: string(dbxBucket.Name),
ProjectID: storj.DeprecatedUUID(project), ProjectID: project,
Created: dbxBucket.CreatedAt, Created: dbxBucket.CreatedAt,
PathCipher: storj.CipherSuite(dbxBucket.PathCipher), PathCipher: storj.CipherSuite(dbxBucket.PathCipher),
DefaultSegmentsSize: int64(dbxBucket.DefaultSegmentSize), DefaultSegmentsSize: int64(dbxBucket.DefaultSegmentSize),
@ -225,7 +225,7 @@ func convertDBXtoBucket(dbxBucket *dbx.BucketMetainfo) (bucket storj.Bucket, err
if err != nil { if err != nil {
return bucket, storj.ErrBucket.Wrap(err) return bucket, storj.ErrBucket.Wrap(err)
} }
bucket.PartnerID = storj.DeprecatedUUID(partnerID) bucket.PartnerID = partnerID
} }
return bucket, nil return bucket, nil

View File

@ -148,7 +148,7 @@ func TestEmptyNotificationsDB(t *testing.T) {
// test notification read with not existing id. // test notification read with not existing id.
t.Run("test notification read with not existing id", func(t *testing.T) { t.Run("test notification read with not existing id", func(t *testing.T) {
err := notificationsdb.Read(ctx, testrand.UUID2()) err := notificationsdb.Read(ctx, testrand.UUID())
assert.Error(t, err, "no rows affected") assert.Error(t, err, "no rows affected")
}) })