@@ -17,6 +17,7 @@ package exporter
1717
1818import (
1919 "context"
20+ "github.com/stretchr/testify/require"
2021 "strings"
2122 "testing"
2223 "time"
@@ -36,7 +37,9 @@ func TestReplsetStatusCollector(t *testing.T) {
3637
3738 ti := labelsGetterMock {}
3839
39- c := newReplicationSetStatusCollector (ctx , client , logrus .New (), false , ti , nil )
40+ version , err := getMongoVersion (ctx , client )
41+ require .NoError (t , err )
42+ c := newReplicationSetStatusCollector (ctx , client , logrus .New (), false , ti , version )
4043
4144 // The last \n at the end of this string is important
4245 expected := strings .NewReader (`
@@ -54,7 +57,7 @@ func TestReplsetStatusCollector(t *testing.T) {
5457 "mongodb_myState" ,
5558 "mongodb_ok" ,
5659 }
57- err : = testutil .CollectAndCompare (c , expected , filter ... )
60+ err = testutil .CollectAndCompare (c , expected , filter ... )
5861 assert .NoError (t , err )
5962}
6063
@@ -66,7 +69,10 @@ func TestReplsetStatusCollectorNoSharding(t *testing.T) {
6669
6770 ti := labelsGetterMock {}
6871
69- c := newReplicationSetStatusCollector (ctx , client , logrus .New (), false , ti , nil )
72+ version , err := getMongoVersion (ctx , client )
73+ require .NoError (t , err )
74+
75+ c := newReplicationSetStatusCollector (ctx , client , logrus .New (), false , ti , version )
7076
7177 // Replication set metrics should not be generated for unsharded server
7278 count := testutil .CollectAndCount (c )
0 commit comments