Skip to content

Commit 0509498

Browse files
authored
test: prevent duplicate metrics collector registration attempted (#2957)
1 parent 04b003c commit 0509498

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/cmd/datastore_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func TestExecuteGC(t *testing.T) {
2121
name: "cockroachdb does not support garbage collection",
2222
cfgBuilder: func(t *testing.T) *datastore.Config {
2323
cfg := datastore.DefaultDatastoreConfig()
24+
cfg.EnableDatastoreMetrics = false // avoid "duplicate metrics collector registration attempted"
2425
cfg.Engine = "cockroachdb"
2526
runningDatastore := datastoreTest.RunDatastoreEngine(t, cfg.Engine)
2627
db := runningDatastore.NewDatabase(t)
@@ -54,6 +55,7 @@ func TestExecuteRepair(t *testing.T) {
5455
name: "cockroachdb does not support repair",
5556
cfgBuilder: func(t *testing.T) *datastore.Config {
5657
cfg := datastore.DefaultDatastoreConfig()
58+
cfg.EnableDatastoreMetrics = false // avoid "duplicate metrics collector registration attempted"
5759
cfg.Engine = "cockroachdb"
5860
runningDatastore := datastoreTest.RunDatastoreEngine(t, cfg.Engine)
5961
db := runningDatastore.NewDatabase(t)
@@ -66,6 +68,7 @@ func TestExecuteRepair(t *testing.T) {
6668
name: "postgres supports repair",
6769
cfgBuilder: func(t *testing.T) *datastore.Config {
6870
cfg := datastore.DefaultDatastoreConfig()
71+
cfg.EnableDatastoreMetrics = false // avoid "duplicate metrics collector registration attempted"
6972
cfg.Engine = "postgres"
7073
runningDatastore := datastoreTest.RunDatastoreEngine(t, cfg.Engine)
7174
db := runningDatastore.NewDatabase(t)

0 commit comments

Comments
 (0)