diff --git a/docker-compose.yml b/docker-compose.yml index 405723a41..d4974c119 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -278,7 +278,7 @@ services: standalone-encrypted: user: root container_name: "standalone-encrypted" - image: percona/percona-server-mongodb:5.0.13-11 + image: ${TEST_MONGODB_IMAGE:-mongo:4.4} ports: - "${TEST_MONGODB_STANDALONE_ENCRYPTED_PORT:-27027}:27017" volumes: diff --git a/exporter/encryption_info_test.go b/exporter/encryption_info_test.go index c1565d06f..8f50bedd6 100644 --- a/exporter/encryption_info_test.go +++ b/exporter/encryption_info_test.go @@ -17,6 +17,7 @@ package exporter import ( "context" + "fmt" "io" "strings" "testing" @@ -32,6 +33,10 @@ import ( func TestGetEncryptionInfo(t *testing.T) { t.Parallel() + version, vendor := getMongoDBVersionInfo(t, "standalone-encrypted") + if vendor != "Percona" { + t.Skip("Test is only for Percona MongoDB as upstream MongoDB does not support encryption") + } ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) defer cancel() @@ -52,13 +57,13 @@ func TestGetEncryptionInfo(t *testing.T) { c := newDiagnosticDataCollector(ctx, client, logger, true, ti, dbBuildInfo) // The last \n at the end of this string is important - expected := strings.NewReader(` + expected := strings.NewReader(fmt.Sprintf(` # HELP mongodb_security_encryption_enabled Shows that encryption is enabled # TYPE mongodb_security_encryption_enabled gauge mongodb_security_encryption_enabled{type="localKeyFile"} 1 # HELP mongodb_version_info The server version # TYPE mongodb_version_info gauge - mongodb_version_info{edition="Community",mongodb="5.0.13-11",vendor="Percona"} 1` + "\n") + mongodb_version_info{edition="Community",mongodb="%s",vendor="%s"} 1`, version, vendor) + "\n") filter := []string{ "mongodb_security_encryption_enabled",