private/testplanet: allow setting "omit" as database to reduce output
Change-Id: I7af90fdefe2ff2df1340aa2b17f40806d889ca18
This commit is contained in:
parent
90e2e3c8c4
commit
1c30efd3a1
@ -16,10 +16,10 @@ import (
|
||||
// We need to define this in a separate package due to https://golang.org/issue/23910.
|
||||
|
||||
// postgres is the test database connection string.
|
||||
var postgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRES_TEST"), "PostgreSQL test database connection string (semicolon delimited for multiple)")
|
||||
var postgres = flag.String("postgres-test-db", os.Getenv("STORJ_POSTGRES_TEST"), "PostgreSQL test database connection string (semicolon delimited for multiple), \"omit\" is used to omit the tests from output")
|
||||
|
||||
// cockroach is the test database connection string for CockroachDB
|
||||
var cockroach = flag.String("cockroach-test-db", os.Getenv("STORJ_COCKROACH_TEST"), "CockroachDB test database connection string (semicolon delimited for multiple)")
|
||||
var cockroach = flag.String("cockroach-test-db", os.Getenv("STORJ_COCKROACH_TEST"), "CockroachDB test database connection string (semicolon delimited for multiple), \"omit\" is used to omit the tests from output")
|
||||
|
||||
// DefaultPostgres is expected to work under the storj-test docker-compose instance
|
||||
const DefaultPostgres = "postgres://storj:storj-pass@test-postgres/teststorj?sslmode=disable"
|
||||
@ -66,7 +66,7 @@ func Run(t *testing.T, test func(ctx *testcontext.Context, t *testing.T, connstr
|
||||
|
||||
// PickPostgres picks a random postgres database from flag.
|
||||
func PickPostgres(t TB) string {
|
||||
if *postgres == "" {
|
||||
if *postgres == "" || strings.EqualFold(*cockroach, "omit") {
|
||||
t.Skip("Postgres flag missing, example: -postgres-test-db=" + DefaultPostgres)
|
||||
}
|
||||
return pickRandom(*postgres)
|
||||
@ -74,7 +74,7 @@ func PickPostgres(t TB) string {
|
||||
|
||||
// PickCockroach picks a random cockroach database from flag.
|
||||
func PickCockroach(t TB) string {
|
||||
if *cockroach == "" {
|
||||
if *cockroach == "" || strings.EqualFold(*cockroach, "omit") {
|
||||
t.Skip("Cockroach flag missing, example: -cockroach-test-db=" + DefaultCockroach)
|
||||
}
|
||||
return pickRandom(*cockroach)
|
||||
|
@ -20,7 +20,7 @@ func Run(t *testing.T, config Config, test func(t *testing.T, ctx *testcontext.C
|
||||
databases := satellitedbtest.Databases()
|
||||
hasDatabase := false
|
||||
for _, db := range databases {
|
||||
hasDatabase = hasDatabase || db.MasterDB.URL != ""
|
||||
hasDatabase = hasDatabase || (db.MasterDB.URL != "" && db.MasterDB.URL != "omit")
|
||||
}
|
||||
if !hasDatabase {
|
||||
t.Fatal("Databases flag missing, set at least one:\n" +
|
||||
@ -30,6 +30,9 @@ func Run(t *testing.T, config Config, test func(t *testing.T, ctx *testcontext.C
|
||||
|
||||
for _, satelliteDB := range satellitedbtest.Databases() {
|
||||
satelliteDB := satelliteDB
|
||||
if satelliteDB.MasterDB.URL == "omit" {
|
||||
continue
|
||||
}
|
||||
t.Run(satelliteDB.Name, func(t *testing.T) {
|
||||
parallel := !config.NonParallel
|
||||
if parallel {
|
||||
|
Loading…
Reference in New Issue
Block a user