Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 7 additions & 2 deletions exporter/encryption_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package exporter

import (
"context"
"fmt"
"io"
"strings"
"testing"
Expand All @@ -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()
Expand All @@ -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",
Expand Down