satellite/satellitedb/satellitedbtest: pass ctx as an argument
ctx is created in most tests, instead pass in as argument to reduce code duplication. Change-Id: I466c51c008392001129c8b007c9d6b3619935ac4
This commit is contained in:
parent
1279eeae39
commit
f3b4bf2b7c
@ -24,10 +24,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSaveBucketTallies(t *testing.T) {
|
func TestSaveBucketTallies(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
// Setup: create bucket storage tallies
|
// Setup: create bucket storage tallies
|
||||||
projectID := testrand.UUID()
|
projectID := testrand.UUID()
|
||||||
|
|
||||||
@ -50,10 +47,7 @@ func TestSaveBucketTallies(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStorageNodeUsage(t *testing.T) {
|
func TestStorageNodeUsage(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
const days = 30
|
const days = 30
|
||||||
|
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
@ -141,10 +135,7 @@ func TestStorageNodeUsage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestProjectLimits(t *testing.T) {
|
func TestProjectLimits(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
proj, err := db.Console().Projects().Insert(ctx, &console.Project{Name: "test", OwnerID: testrand.UUID()})
|
proj, err := db.Console().Projects().Insert(ctx, &console.Project{Name: "test", OwnerID: testrand.UUID()})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -229,10 +229,7 @@ func createBucketBandwidthRollups(ctx *testcontext.Context, satelliteDB satellit
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestProjectBandwidthTotal(t *testing.T) {
|
func TestProjectBandwidthTotal(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
pdb := db.ProjectAccounting()
|
pdb := db.ProjectAccounting()
|
||||||
projectID := testrand.UUID()
|
projectID := testrand.UUID()
|
||||||
|
|
||||||
@ -311,10 +308,7 @@ func TestUsageRollups(t *testing.T) {
|
|||||||
tallyInterval = time.Hour
|
tallyInterval = time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
start := now.Add(tallyInterval * time.Duration(-tallyIntervals))
|
start := now.Add(tallyInterval * time.Duration(-tallyIntervals))
|
||||||
|
|
||||||
|
@ -62,12 +62,8 @@ func (testData *AttributionTestData) init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDB(t *testing.T) {
|
func TestDB(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
attributionDB := db.Attribution()
|
attributionDB := db.Attribution()
|
||||||
|
|
||||||
project1, project2 := testrand.UUID(), testrand.UUID()
|
project1, project2 := testrand.UUID(), testrand.UUID()
|
||||||
partner1, partner2 := testrand.UUID(), testrand.UUID()
|
partner1, partner2 := testrand.UUID(), testrand.UUID()
|
||||||
|
|
||||||
@ -95,10 +91,7 @@ func TestDB(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestQueryAttribution(t *testing.T) {
|
func TestQueryAttribution(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
|
|
||||||
projectID := testrand.UUID()
|
projectID := testrand.UUID()
|
||||||
|
@ -17,10 +17,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestApiKeysRepository(t *testing.T) {
|
func TestApiKeysRepository(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
projects := db.Console().Projects()
|
projects := db.Console().Projects()
|
||||||
apikeys := db.Console().APIKeys()
|
apikeys := db.Console().APIKeys()
|
||||||
|
|
||||||
|
@ -44,10 +44,7 @@ func (*discardSender) FromAddress() post.Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGrapqhlMutation(t *testing.T) {
|
func TestGrapqhlMutation(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
log := zaptest.NewLogger(t)
|
log := zaptest.NewLogger(t)
|
||||||
|
|
||||||
partnersService := rewards.NewPartnersService(
|
partnersService := rewards.NewPartnersService(
|
||||||
|
@ -29,10 +29,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGraphqlQuery(t *testing.T) {
|
func TestGraphqlQuery(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
log := zaptest.NewLogger(t)
|
log := zaptest.NewLogger(t)
|
||||||
|
|
||||||
partnersService := rewards.NewPartnersService(
|
partnersService := rewards.NewPartnersService(
|
||||||
|
@ -18,11 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestProjectMembersRepository(t *testing.T) {
|
func TestProjectMembersRepository(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { // repositories
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
// repositories
|
|
||||||
users := db.Console().Users()
|
users := db.Console().Users()
|
||||||
projects := db.Console().Projects()
|
projects := db.Console().Projects()
|
||||||
projectMembers := db.Console().ProjectMembers()
|
projectMembers := db.Console().ProjectMembers()
|
||||||
|
@ -32,11 +32,7 @@ func TestProjectsRepository(t *testing.T) {
|
|||||||
newDescription = "some new description"
|
newDescription = "some new description"
|
||||||
)
|
)
|
||||||
|
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { // repositories
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
// repositories
|
|
||||||
users := db.Console().Users()
|
users := db.Console().Users()
|
||||||
projects := db.Console().Projects()
|
projects := db.Console().Projects()
|
||||||
var project *console.Project
|
var project *console.Project
|
||||||
|
@ -25,10 +25,7 @@ func TestNewRegistrationSecret(t *testing.T) {
|
|||||||
userFullName = "name"
|
userFullName = "name"
|
||||||
)
|
)
|
||||||
|
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
users := db.Console().Users()
|
users := db.Console().Users()
|
||||||
rptokens := db.Console().ResetPasswordTokens()
|
rptokens := db.Console().ResetPasswordTokens()
|
||||||
|
|
||||||
|
@ -21,10 +21,7 @@ import (
|
|||||||
|
|
||||||
func TestUserCredits(t *testing.T) {
|
func TestUserCredits(t *testing.T) {
|
||||||
t.Skip("Skip until usercredits.Create method is cockroach compatible. https://github.com/cockroachdb/cockroach/issues/42881")
|
t.Skip("Skip until usercredits.Create method is cockroach compatible. https://github.com/cockroachdb/cockroach/issues/42881")
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
consoleDB := db.Console()
|
consoleDB := db.Console()
|
||||||
|
|
||||||
user, referrer, activeOffer, defaultOffer := setupData(ctx, t, db)
|
user, referrer, activeOffer, defaultOffer := setupData(ctx, t, db)
|
||||||
|
@ -30,10 +30,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestUserRepository(t *testing.T) {
|
func TestUserRepository(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
repository := db.Console().Users()
|
repository := db.Console().Users()
|
||||||
partnerID := testrand.UUID()
|
partnerID := testrand.UUID()
|
||||||
|
|
||||||
@ -62,10 +59,7 @@ func TestUserRepository(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUserEmailCase(t *testing.T) {
|
func TestUserEmailCase(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
for _, testCase := range []struct {
|
for _, testCase := range []struct {
|
||||||
email string
|
email string
|
||||||
}{
|
}{
|
||||||
|
@ -17,10 +17,7 @@ import (
|
|||||||
|
|
||||||
func TestDowntime(t *testing.T) {
|
func TestDowntime(t *testing.T) {
|
||||||
// test basic downtime functionality
|
// test basic downtime functionality
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
downtimeDB := db.DowntimeTracking()
|
downtimeDB := db.DowntimeTracking()
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
|
|
||||||
"storj.io/storj/private/testplanet"
|
"storj.io/storj/private/testplanet"
|
||||||
|
@ -20,10 +20,7 @@ import (
|
|||||||
|
|
||||||
func TestProgress(t *testing.T) {
|
func TestProgress(t *testing.T) {
|
||||||
// test basic graceful exit progress crud
|
// test basic graceful exit progress crud
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
geDB := db.GracefulExit()
|
geDB := db.GracefulExit()
|
||||||
|
|
||||||
testData := []struct {
|
testData := []struct {
|
||||||
@ -59,10 +56,7 @@ func TestProgress(t *testing.T) {
|
|||||||
|
|
||||||
func TestTransferQueueItem(t *testing.T) {
|
func TestTransferQueueItem(t *testing.T) {
|
||||||
// test basic graceful exit transfer queue crud
|
// test basic graceful exit transfer queue crud
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
geDB := db.GracefulExit()
|
geDB := db.GracefulExit()
|
||||||
|
|
||||||
nodeID1 := testrand.NodeID()
|
nodeID1 := testrand.NodeID()
|
||||||
|
@ -19,10 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGetExitingNodes(t *testing.T) {
|
func TestGetExitingNodes(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
cache := db.OverlayCache()
|
cache := db.OverlayCache()
|
||||||
exiting := make(map[storj.NodeID]bool)
|
exiting := make(map[storj.NodeID]bool)
|
||||||
exitingCount := 0
|
exitingCount := 0
|
||||||
@ -90,10 +87,7 @@ func TestGetExitingNodes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetGracefulExitNodesByTimeframe(t *testing.T) {
|
func TestGetGracefulExitNodesByTimeframe(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
cache := db.OverlayCache()
|
cache := db.OverlayCache()
|
||||||
exitingToday := make(map[storj.NodeID]bool)
|
exitingToday := make(map[storj.NodeID]bool)
|
||||||
exitingLastWeek := make(map[storj.NodeID]bool)
|
exitingLastWeek := make(map[storj.NodeID]bool)
|
||||||
|
@ -41,10 +41,7 @@ func newTestBucket(name string, projectID uuid.UUID) storj.Bucket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBasicBucketOperations(t *testing.T) {
|
func TestBasicBucketOperations(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
consoleDB := db.Console()
|
consoleDB := db.Console()
|
||||||
project, err := consoleDB.Projects().Insert(ctx, &console.Project{Name: "testproject1"})
|
project, err := consoleDB.Projects().Insert(ctx, &console.Project{Name: "testproject1"})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -89,10 +86,7 @@ func TestListBucketsAllAllowed(t *testing.T) {
|
|||||||
{"non matching cursor, more", "ccc", 3, 3, true},
|
{"non matching cursor, more", "ccc", 3, 3, true},
|
||||||
{"first bucket cursor, more", "0test", 5, 5, true},
|
{"first bucket cursor, more", "0test", 5, 5, true},
|
||||||
}
|
}
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
consoleDB := db.Console()
|
consoleDB := db.Console()
|
||||||
project, err := consoleDB.Projects().Insert(ctx, &console.Project{Name: "testproject1"})
|
project, err := consoleDB.Projects().Insert(ctx, &console.Project{Name: "testproject1"})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -152,10 +146,7 @@ func TestListBucketsNotAllowed(t *testing.T) {
|
|||||||
{"last bucket cursor, allow all", "zzz", 2, 1, false, true, map[string]struct{}{"zzz": {}}, []string{"zzz"}},
|
{"last bucket cursor, allow all", "zzz", 2, 1, false, true, map[string]struct{}{"zzz": {}}, []string{"zzz"}},
|
||||||
{"empty string cursor, allow all, more", "", 5, 5, true, true, map[string]struct{}{"": {}}, []string{"123", "0test", "999", "aaa", "bbb"}},
|
{"empty string cursor, allow all, more", "", 5, 5, true, true, map[string]struct{}{"": {}}, []string{"123", "0test", "999", "aaa", "bbb"}},
|
||||||
}
|
}
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
consoleDB := db.Console()
|
consoleDB := db.Console()
|
||||||
project, err := consoleDB.Projects().Insert(ctx, &console.Project{Name: "testproject1"})
|
project, err := consoleDB.Projects().Insert(ctx, &console.Project{Name: "testproject1"})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -283,9 +283,7 @@ func buildBenchmarkData(ctx context.Context, b *testing.B, db satellite.DB, stor
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestProcessOrders(t *testing.T) {
|
func TestProcessOrders(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
ordersDB := db.Orders()
|
ordersDB := db.Orders()
|
||||||
serialNum := storj.SerialNumber{1}
|
serialNum := storj.SerialNumber{1}
|
||||||
serialNum2 := storj.SerialNumber{2}
|
serialNum2 := storj.SerialNumber{2}
|
||||||
|
@ -39,10 +39,7 @@ func getTotalBandwidthInGB(ctx context.Context, accountingDB accounting.ProjectA
|
|||||||
// TestOrdersWriteCacheBatchLimitReached makes sure bandwidth rollup values are not written to the
|
// TestOrdersWriteCacheBatchLimitReached makes sure bandwidth rollup values are not written to the
|
||||||
// db until the batch size is reached.
|
// db until the batch size is reached.
|
||||||
func TestOrdersWriteCacheBatchLimitReached(t *testing.T) {
|
func TestOrdersWriteCacheBatchLimitReached(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
useBatchSize := 10
|
useBatchSize := 10
|
||||||
amount := (memory.MB * 500).Int64()
|
amount := (memory.MB * 500).Int64()
|
||||||
projectID := testrand.UUID()
|
projectID := testrand.UUID()
|
||||||
|
@ -17,10 +17,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSerialNumbers(t *testing.T) {
|
func TestSerialNumbers(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
ordersDB := db.Orders()
|
ordersDB := db.Orders()
|
||||||
|
|
||||||
expectedBucket := []byte("bucketID")
|
expectedBucket := []byte("bucketID")
|
||||||
|
@ -17,10 +17,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestPeerIdentities(t *testing.T) {
|
func TestPeerIdentities(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
encode := identity.EncodePeerIdentity
|
encode := identity.EncodePeerIdentity
|
||||||
|
|
||||||
idents := db.PeerIdentities()
|
idents := db.PeerIdentities()
|
||||||
|
@ -19,10 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestDB_PieceCounts(t *testing.T) {
|
func TestDB_PieceCounts(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
overlaydb := db.OverlayCache()
|
overlaydb := db.OverlayCache()
|
||||||
|
|
||||||
type TestNode struct {
|
type TestNode struct {
|
||||||
|
@ -28,10 +28,7 @@ import (
|
|||||||
func TestCache_Database(t *testing.T) {
|
func TestCache_Database(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
testCache(ctx, t, db.OverlayCache())
|
testCache(ctx, t, db.OverlayCache())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -174,10 +171,7 @@ func TestRandomizedSelection(t *testing.T) {
|
|||||||
numNodesToSelect := 100
|
numNodesToSelect := 100
|
||||||
minSelectCount := 3 // TODO: compute this limit better
|
minSelectCount := 3 // TODO: compute this limit better
|
||||||
|
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
cache := db.OverlayCache()
|
cache := db.OverlayCache()
|
||||||
allIDs := make(storj.NodeIDList, totalNodes)
|
allIDs := make(storj.NodeIDList, totalNodes)
|
||||||
nodeCounts := make(map[storj.NodeID]int)
|
nodeCounts := make(map[storj.NodeID]int)
|
||||||
@ -347,11 +341,7 @@ func TestKnownReliable(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateCheckIn(t *testing.T) {
|
func TestUpdateCheckIn(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { // setup
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
// setup
|
|
||||||
nodeID := storj.NodeID{1, 2, 3}
|
nodeID := storj.NodeID{1, 2, 3}
|
||||||
expectedEmail := "test@email.com"
|
expectedEmail := "test@email.com"
|
||||||
expectedAddress := "1.2.4.4"
|
expectedAddress := "1.2.4.4"
|
||||||
@ -499,10 +489,7 @@ func TestUpdateCheckIn(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCache_DowntimeTracking(t *testing.T) {
|
func TestCache_DowntimeTracking(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
cache := db.OverlayCache()
|
cache := db.OverlayCache()
|
||||||
defaults := overlay.NodeSelectionConfig{
|
defaults := overlay.NodeSelectionConfig{
|
||||||
AuditReputationAlpha0: 1,
|
AuditReputationAlpha0: 1,
|
||||||
@ -559,11 +546,7 @@ func TestCache_DowntimeTracking(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetSuccesfulNodesNotCheckedInSince(t *testing.T) {
|
func TestGetSuccesfulNodesNotCheckedInSince(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) { // setup
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
// setup
|
|
||||||
info1 := getNodeInfo(testrand.NodeID())
|
info1 := getNodeInfo(testrand.NodeID())
|
||||||
info2 := getNodeInfo(testrand.NodeID())
|
info2 := getNodeInfo(testrand.NodeID())
|
||||||
|
|
||||||
|
@ -20,16 +20,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestStatDB(t *testing.T) {
|
func TestStatDB(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
testDatabase(ctx, t, db.OverlayCache())
|
testDatabase(ctx, t, db.OverlayCache())
|
||||||
})
|
})
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
testDatabase(ctx, t, overlay.NewCombinedCache(db.OverlayCache()))
|
testDatabase(ctx, t, overlay.NewCombinedCache(db.OverlayCache()))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCouponRepository(t *testing.T) {
|
func TestCouponRepository(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
couponsRepo := db.StripeCoinPayments().Coupons()
|
couponsRepo := db.StripeCoinPayments().Coupons()
|
||||||
coupon := payments.Coupon{
|
coupon := payments.Coupon{
|
||||||
Duration: 2,
|
Duration: 2,
|
||||||
@ -105,10 +102,7 @@ func TestCouponRepository(t *testing.T) {
|
|||||||
// 8. Populating coupons again. For 6 users above. Only 1 new coupon should be added.
|
// 8. Populating coupons again. For 6 users above. Only 1 new coupon should be added.
|
||||||
// Three new coupons total should be added by 2 runs of PopulatePromotionalCoupons method.
|
// Three new coupons total should be added by 2 runs of PopulatePromotionalCoupons method.
|
||||||
func TestPopulatePromotionalCoupons(t *testing.T) {
|
func TestPopulatePromotionalCoupons(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
usersRepo := db.Console().Users()
|
usersRepo := db.Console().Users()
|
||||||
projectsRepo := db.Console().Projects()
|
projectsRepo := db.Console().Projects()
|
||||||
couponsRepo := db.StripeCoinPayments().Coupons()
|
couponsRepo := db.StripeCoinPayments().Coupons()
|
||||||
|
@ -19,10 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCustomersRepository(t *testing.T) {
|
func TestCustomersRepository(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
customers := db.StripeCoinPayments().Customers()
|
customers := db.StripeCoinPayments().Customers()
|
||||||
|
|
||||||
customerID := "customerID"
|
customerID := "customerID"
|
||||||
@ -48,10 +45,7 @@ func TestCustomersRepository(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCustomersRepositoryList(t *testing.T) {
|
func TestCustomersRepositoryList(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
customersDB := db.StripeCoinPayments().Customers()
|
customersDB := db.StripeCoinPayments().Customers()
|
||||||
|
|
||||||
const custLen = 5
|
const custLen = 5
|
||||||
|
@ -18,10 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestProjectRecords(t *testing.T) {
|
func TestProjectRecords(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
utc := time.Now().UTC()
|
utc := time.Now().UTC()
|
||||||
|
|
||||||
prjID, err := uuid.New()
|
prjID, err := uuid.New()
|
||||||
@ -70,10 +67,7 @@ func TestProjectRecords(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestProjectRecordsList(t *testing.T) {
|
func TestProjectRecordsList(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
utc := time.Now().UTC()
|
utc := time.Now().UTC()
|
||||||
|
|
||||||
start := time.Date(utc.Year(), utc.Month(), 1, 0, 0, 0, 0, time.UTC)
|
start := time.Date(utc.Year(), utc.Month(), 1, 0, 0, 0, 0, time.UTC)
|
||||||
|
@ -23,10 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTransactionsDB(t *testing.T) {
|
func TestTransactionsDB(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
transactions := db.StripeCoinPayments().Transactions()
|
transactions := db.StripeCoinPayments().Transactions()
|
||||||
|
|
||||||
amount, ok := new(big.Float).SetPrec(1000).SetString("2.0000000000000000005")
|
amount, ok := new(big.Float).SetPrec(1000).SetString("2.0000000000000000005")
|
||||||
@ -151,7 +148,7 @@ func TestTransactionsDBList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
t.Run("pending transactions", func(t *testing.T) {
|
t.Run("pending transactions", func(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
for _, tx := range txs {
|
for _, tx := range txs {
|
||||||
_, err := db.StripeCoinPayments().Transactions().Insert(ctx, tx)
|
_, err := db.StripeCoinPayments().Transactions().Insert(ctx, tx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -173,7 +170,7 @@ func TestTransactionsDBList(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("unapplied transaction", func(t *testing.T) {
|
t.Run("unapplied transaction", func(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
var updatedTxs []stripecoinpayments.Transaction
|
var updatedTxs []stripecoinpayments.Transaction
|
||||||
var updates []stripecoinpayments.TransactionUpdate
|
var updates []stripecoinpayments.TransactionUpdate
|
||||||
var applies coinpayments.TransactionIDList
|
var applies coinpayments.TransactionIDList
|
||||||
@ -216,10 +213,7 @@ func TestTransactionsDBList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTransactionsDBRates(t *testing.T) {
|
func TestTransactionsDBRates(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
transactions := db.StripeCoinPayments().Transactions()
|
transactions := db.StripeCoinPayments().Transactions()
|
||||||
|
|
||||||
val, ok := new(big.Float).SetPrec(1000).SetString("4.0000000000000000005")
|
val, ok := new(big.Float).SetPrec(1000).SetString("4.0000000000000000005")
|
||||||
|
@ -18,10 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestIrreparable(t *testing.T) {
|
func TestIrreparable(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
irrdb := db.Irreparable()
|
irrdb := db.Irreparable()
|
||||||
|
|
||||||
// Create and insert test segment infos into DB
|
// Create and insert test segment infos into DB
|
||||||
|
@ -20,10 +20,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestUntilEmpty(t *testing.T) {
|
func TestUntilEmpty(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
repairQueue := db.RepairQueue()
|
repairQueue := db.RepairQueue()
|
||||||
|
|
||||||
// insert a bunch of segments
|
// insert a bunch of segments
|
||||||
@ -53,10 +50,7 @@ func TestUntilEmpty(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrder(t *testing.T) {
|
func TestOrder(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
repairQueue := db.RepairQueue()
|
repairQueue := db.RepairQueue()
|
||||||
|
|
||||||
nullPath := []byte("/path/null")
|
nullPath := []byte("/path/null")
|
||||||
@ -120,10 +114,7 @@ func TestOrder(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCount(t *testing.T) {
|
func TestCount(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
repairQueue := db.RepairQueue()
|
repairQueue := db.RepairQueue()
|
||||||
|
|
||||||
// insert a bunch of segments
|
// insert a bunch of segments
|
||||||
|
@ -19,10 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestInsertSelect(t *testing.T) {
|
func TestInsertSelect(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
q := db.RepairQueue()
|
q := db.RepairQueue()
|
||||||
|
|
||||||
seg := &pb.InjuredSegment{
|
seg := &pb.InjuredSegment{
|
||||||
@ -40,10 +37,7 @@ func TestInsertSelect(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInsertDuplicate(t *testing.T) {
|
func TestInsertDuplicate(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
q := db.RepairQueue()
|
q := db.RepairQueue()
|
||||||
|
|
||||||
seg := &pb.InjuredSegment{
|
seg := &pb.InjuredSegment{
|
||||||
@ -58,10 +52,7 @@ func TestInsertDuplicate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDequeueEmptyQueue(t *testing.T) {
|
func TestDequeueEmptyQueue(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
q := db.RepairQueue()
|
q := db.RepairQueue()
|
||||||
|
|
||||||
_, err := q.Select(ctx)
|
_, err := q.Select(ctx)
|
||||||
@ -71,10 +62,7 @@ func TestDequeueEmptyQueue(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSequential(t *testing.T) {
|
func TestSequential(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
q := db.RepairQueue()
|
q := db.RepairQueue()
|
||||||
|
|
||||||
const N = 100
|
const N = 100
|
||||||
@ -112,10 +100,7 @@ func TestSequential(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParallel(t *testing.T) {
|
func TestParallel(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
q := db.RepairQueue()
|
q := db.RepairQueue()
|
||||||
const N = 100
|
const N = 100
|
||||||
entries := make(chan *pb.InjuredSegment, N)
|
entries := make(chan *pb.InjuredSegment, N)
|
||||||
|
@ -19,10 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestUsers(t *testing.T) {
|
func TestUsers(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
consoleDB := db.Console()
|
consoleDB := db.Console()
|
||||||
|
|
||||||
// create user
|
// create user
|
||||||
|
@ -17,10 +17,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestConsoleTx(t *testing.T) {
|
func TestConsoleTx(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
ctx := testcontext.New(t)
|
|
||||||
defer ctx.Cleanup()
|
|
||||||
|
|
||||||
dbConsole := db.Console()
|
dbConsole := db.Console()
|
||||||
|
|
||||||
t.Run("WithTx with success", func(t *testing.T) {
|
t.Run("WithTx with success", func(t *testing.T) {
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/zeebo/errs"
|
"github.com/zeebo/errs"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zaptest"
|
"go.uber.org/zap/zaptest"
|
||||||
|
|
||||||
"storj.io/common/testcontext"
|
"storj.io/common/testcontext"
|
||||||
|
|
||||||
"storj.io/storj/private/dbutil"
|
"storj.io/storj/private/dbutil"
|
||||||
@ -161,7 +162,7 @@ func CreatePointerDBOnTopOf(ctx context.Context, log *zap.Logger, tempDB *dbutil
|
|||||||
|
|
||||||
// Run method will iterate over all supported databases. Will establish
|
// Run method will iterate over all supported databases. Will establish
|
||||||
// connection and will create tables for each DB.
|
// connection and will create tables for each DB.
|
||||||
func Run(t *testing.T, test func(t *testing.T, db satellite.DB)) {
|
func Run(t *testing.T, test func(ctx *testcontext.Context, t *testing.T, db satellite.DB)) {
|
||||||
for _, dbInfo := range Databases() {
|
for _, dbInfo := range Databases() {
|
||||||
dbInfo := dbInfo
|
dbInfo := dbInfo
|
||||||
t.Run(dbInfo.MasterDB.Name+"/"+dbInfo.PointerDB.Name, func(t *testing.T) {
|
t.Run(dbInfo.MasterDB.Name+"/"+dbInfo.PointerDB.Name, func(t *testing.T) {
|
||||||
@ -191,7 +192,7 @@ func Run(t *testing.T, test func(t *testing.T, db satellite.DB)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: pass the ctx down
|
// TODO: pass the ctx down
|
||||||
test(t, db)
|
test(ctx, t, db)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,12 @@ package satellitedbtest_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"storj.io/common/testcontext"
|
||||||
"storj.io/storj/satellite"
|
"storj.io/storj/satellite"
|
||||||
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDatabase(t *testing.T) {
|
func TestDatabase(t *testing.T) {
|
||||||
satellitedbtest.Run(t, func(t *testing.T, db satellite.DB) {
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -510,4 +510,3 @@ func Schema() map[string]*dbschema.Schema {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user