diff --git a/Jenkinsfile.public b/Jenkinsfile.public index c3b98686a..9901357df 100644 --- a/Jenkinsfile.public +++ b/Jenkinsfile.public @@ -34,6 +34,7 @@ pipeline { sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26257 --http-addr=localhost:8087 --cache 512MiB --max-sql-memory 512MiB --background' sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26258 --http-addr=localhost:8088 --cache 512MiB --max-sql-memory 512MiB --background' sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26259 --http-addr=localhost:8089 --cache 512MiB --max-sql-memory 512MiB --background' + sh 'cockroach start-single-node --insecure --store=type=mem,size=2GiB --listen-addr=localhost:26260 --http-addr=localhost:8090 --cache 256MiB --max-sql-memory 256MiB --background' } } @@ -62,6 +63,7 @@ pipeline { 'cockroach://root@localhost:26257/testcockroach?sslmode=disable;' + 'cockroach://root@localhost:26258/testcockroach?sslmode=disable;' + 'cockroach://root@localhost:26259/testcockroach?sslmode=disable' + STORJ_TEST_COCKROACH_ALT = 'cockroach://root@localhost:26260/testcockroach?sslmode=disable' STORJ_TEST_POSTGRES = 'postgres://postgres@localhost/teststorj?sslmode=disable' COVERFLAGS = "${ env.BRANCH_NAME != 'master' ? '' : '-coverprofile=.build/coverprofile -coverpkg=storj.io/storj/private/...,storj.io/storj/pkg/...,storj.io/storj/satellite/...,storj.io/storj/storage/...,storj.io/storj/storagenode/...,storj.io/storj/versioncontrol/...'}" } @@ -70,6 +72,7 @@ pipeline { sh 'cockroach sql --insecure --host=localhost:26257 -e \'create database testcockroach;\'' sh 'cockroach sql --insecure --host=localhost:26258 -e \'create database testcockroach;\'' sh 'cockroach sql --insecure --host=localhost:26259 -e \'create database testcockroach;\'' + sh 'cockroach sql --insecure --host=localhost:26260 -e \'create database testcockroach;\'' sh 'psql -U postgres -c \'create database teststorj;\'' sh 'use-ports -from 1024 -to 10000 &' diff --git a/private/dbutil/pgtest/flag.go b/private/dbutil/pgtest/flag.go index 0acf9a8d3..1bad69530 100644 --- a/private/dbutil/pgtest/flag.go +++ b/private/dbutil/pgtest/flag.go @@ -30,6 +30,7 @@ var postgres = flag.String("postgres-test-db", getenv("STORJ_TEST_POSTGRES", "ST // cockroach is the test database connection string for CockroachDB. var cockroach = flag.String("cockroach-test-db", getenv("STORJ_TEST_COCKROACH", "STORJ_COCKROACH_TEST"), "CockroachDB test database connection string (semicolon delimited for multiple), \"omit\" is used to omit the tests from output") +var cockroachAlt = flag.String("cockroach-test-alt-db", getenv("STORJ_TEST_COCKROACH_ALT"), "CockroachDB test database connection alternate 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" @@ -92,6 +93,20 @@ func PickCockroach(t TB) string { return pickRandom(*cockroach) } +// PickCockroachAlt picks an alternate cockroach database from flag. +// +// This is used for high-load tests to ensure that other tests do not timeout. +func PickCockroachAlt(t TB) string { + if *cockroachAlt == "" { + return PickCockroach(t) + } + if strings.EqualFold(*cockroachAlt, "omit") { + t.Skip("Cockroach alt flag omitted.") + } + + return pickRandom(*cockroachAlt) +} + func pickRandom(dbstr string) string { values := strings.Split(dbstr, ";") if len(values) <= 1 { diff --git a/satellite/satellitedb/migrate_test.go b/satellite/satellitedb/migrate_test.go index 64bfa0db6..a0ec0f4b9 100644 --- a/satellite/satellitedb/migrate_test.go +++ b/satellite/satellitedb/migrate_test.go @@ -132,7 +132,7 @@ func loadSchemaFromSQL(ctx context.Context, connstr, script string) (_ *dbschema } func TestMigratePostgres(t *testing.T) { migrateTest(t, pgtest.PickPostgres(t)) } -func TestMigrateCockroach(t *testing.T) { migrateTest(t, pgtest.PickCockroach(t)) } +func TestMigrateCockroach(t *testing.T) { migrateTest(t, pgtest.PickCockroachAlt(t)) } // satelliteDB provides access to certain methods on a *satellitedb.satelliteDB // instance, since that type is not exported.