Skip to content

Commit

Permalink
fix: only use recommended settings in root user tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martskins authored and stevenh committed Nov 5, 2024
1 parent cf8625d commit 50878ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/cockroachdb/cockroachdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func TestCockroach_NotRoot(t *testing.T) {
url: "postgres://test@localhost:xxxxx/defaultdb?sslmode=disable",
opts: []testcontainers.ContainerCustomizer{
cockroachdb.WithUser("test"),
// Do not run the default statements as the user used on this test is
// lacking the needed MODIFYCLUSTERSETTING privilege to run them.
cockroachdb.WithStatements(),
},
})
}
Expand All @@ -38,6 +41,9 @@ func TestCockroach_Password(t *testing.T) {
opts: []testcontainers.ContainerCustomizer{
cockroachdb.WithUser("foo"),
cockroachdb.WithPassword("bar"),
// Do not run the default statements as the user used on this test is
// lacking the needed MODIFYCLUSTERSETTING privilege to run them.
cockroachdb.WithStatements(),
},
})
}
Expand All @@ -50,6 +56,9 @@ func TestCockroach_TLS(t *testing.T) {
url: "postgres://root@localhost:xxxxx/defaultdb?sslmode=verify-full",
opts: []testcontainers.ContainerCustomizer{
cockroachdb.WithTLS(tlsCfg),
// Do not run the default statements as the user used on this test is
// lacking the needed MODIFYCLUSTERSETTING privilege to run them.
cockroachdb.WithStatements(),
},
})
}
Expand Down
1 change: 1 addition & 0 deletions modules/cockroachdb/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func WithTLS(cfg *TLSConfig) Option {
}

// DefaultStatements are the settings recommended by Cockroach Labs for testing clusters.
// Note that to use these defaults the user needs to have MODIFYCLUSTERSETTING privilege.
// See https://www.cockroachlabs.com/docs/stable/local-testing for more information.
var DefaultStatements = []string{
"SET CLUSTER SETTING kv.range_merge.queue_interval = '50ms'",
Expand Down

0 comments on commit 50878ca

Please sign in to comment.