satellite/satellitedb/satellitedbtest: skip omitted database

The first implementation missed some changes.

Change-Id: I7ae696175e0a9ea46954970ba8547638a05ed5a9
This commit is contained in:
Egon Elbre 2020-06-11 12:37:13 +03:00
parent 0826c8d87f
commit 1ed5a1bac5
3 changed files with 15 additions and 4 deletions

View File

@ -51,9 +51,11 @@ func Databases() []Database {
func Run(t *testing.T, test func(ctx *testcontext.Context, t *testing.T, connstr string)) {
for _, db := range Databases() {
db := db
connstr := db.Pick(t)
if strings.EqualFold(connstr, "omit") {
continue
}
t.Run(db.Name, func(t *testing.T) {
connstr := db.Pick(t)
t.Parallel()
ctx := testcontext.New(t)
@ -66,7 +68,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 == "" || strings.EqualFold(*cockroach, "omit") {
if *postgres == "" || strings.EqualFold(*postgres, "omit") {
t.Skip("Postgres flag missing, example: -postgres-test-db=" + DefaultPostgres)
}
return pickRandom(*postgres)

View File

@ -5,6 +5,7 @@ package testplanet
import (
"context"
"strings"
"testing"
"go.uber.org/zap/zaptest"
@ -30,7 +31,7 @@ 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" {
if strings.EqualFold(satelliteDB.MasterDB.URL, "omit") {
continue
}
t.Run(satelliteDB.Name, func(t *testing.T) {

View File

@ -175,6 +175,10 @@ func CreatePointerDBOnTopOf(ctx context.Context, log *zap.Logger, tempDB *dbutil
func Run(t *testing.T, test func(ctx *testcontext.Context, t *testing.T, db satellite.DB)) {
for _, dbInfo := range Databases() {
dbInfo := dbInfo
if strings.EqualFold(dbInfo.MasterDB.URL, "omit") {
continue
}
t.Run(dbInfo.Name, func(t *testing.T) {
t.Parallel()
@ -211,6 +215,10 @@ func Run(t *testing.T, test func(ctx *testcontext.Context, t *testing.T, db sate
func Bench(b *testing.B, bench func(b *testing.B, db satellite.DB)) {
for _, dbInfo := range Databases() {
dbInfo := dbInfo
if strings.EqualFold(dbInfo.MasterDB.URL, "omit") {
continue
}
b.Run(dbInfo.Name, func(b *testing.B) {
if dbInfo.MasterDB.URL == "" {
b.Skipf("Database %s connection string not provided. %s", dbInfo.MasterDB.Name, dbInfo.MasterDB.Message)