satellite/satellitedb: separate cockroach for migration tests
Currently Cockroach migration test is the most heavy with regards to schema changes. This causes other tests to time out. This adds an alternate cockroach instance that is used for migration tests. Change-Id: I01fe9313527ff002f0bb0914dd52c3645b8eaf6d
This commit is contained in:
parent
79eb682f9c
commit
2d27bc8787
@ -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: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: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: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:26257/testcockroach?sslmode=disable;' +
|
||||||
'cockroach://root@localhost:26258/testcockroach?sslmode=disable;' +
|
'cockroach://root@localhost:26258/testcockroach?sslmode=disable;' +
|
||||||
'cockroach://root@localhost:26259/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'
|
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/...'}"
|
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:26257 -e \'create database testcockroach;\''
|
||||||
sh 'cockroach sql --insecure --host=localhost:26258 -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: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 'psql -U postgres -c \'create database teststorj;\''
|
||||||
sh 'use-ports -from 1024 -to 10000 &'
|
sh 'use-ports -from 1024 -to 10000 &'
|
||||||
|
@ -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.
|
// 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 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.
|
// DefaultPostgres is expected to work under the storj-test docker-compose instance.
|
||||||
const DefaultPostgres = "postgres://storj:storj-pass@test-postgres/teststorj?sslmode=disable"
|
const DefaultPostgres = "postgres://storj:storj-pass@test-postgres/teststorj?sslmode=disable"
|
||||||
@ -92,6 +93,20 @@ func PickCockroach(t TB) string {
|
|||||||
return pickRandom(*cockroach)
|
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 {
|
func pickRandom(dbstr string) string {
|
||||||
values := strings.Split(dbstr, ";")
|
values := strings.Split(dbstr, ";")
|
||||||
if len(values) <= 1 {
|
if len(values) <= 1 {
|
||||||
|
@ -132,7 +132,7 @@ func loadSchemaFromSQL(ctx context.Context, connstr, script string) (_ *dbschema
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMigratePostgres(t *testing.T) { migrateTest(t, pgtest.PickPostgres(t)) }
|
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
|
// satelliteDB provides access to certain methods on a *satellitedb.satelliteDB
|
||||||
// instance, since that type is not exported.
|
// instance, since that type is not exported.
|
||||||
|
Loading…
Reference in New Issue
Block a user