From 7a0500a0acc380dfd030fe8c74c0a6178535ebe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C4=8Ctvrtka?= Date: Mon, 2 Dec 2024 14:00:56 +0100 Subject: [PATCH] PMM-12634 Expect false in exporter options. --- managed/models/agent_helpers_test.go | 94 ++++++++++++++-------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/managed/models/agent_helpers_test.go b/managed/models/agent_helpers_test.go index 48e363ff80..2deebfafcd 100644 --- a/managed/models/agent_helpers_test.go +++ b/managed/models/agent_helpers_test.go @@ -165,17 +165,15 @@ func TestAgentHelpers(t *testing.T) { }, }, &models.Agent{ - AgentID: "A9", - AgentType: models.MongoDBExporterType, - PMMAgentID: pointer.ToString("A9"), - RunsOnNodeID: nil, - NodeID: pointer.ToString("N1"), - ListenPort: pointer.ToUint16(8200), - TLS: true, - TLSSkipVerify: true, - ExporterOptions: &models.ExporterOptions{ - PushMetrics: false, - }, + AgentID: "A9", + AgentType: models.MongoDBExporterType, + PMMAgentID: pointer.ToString("A9"), + RunsOnNodeID: nil, + NodeID: pointer.ToString("N1"), + ListenPort: pointer.ToUint16(8200), + TLS: true, + TLSSkipVerify: true, + ExporterOptions: &models.ExporterOptions{}, MongoDBOptions: &models.MongoDBOptions{ TLSCertificateKey: "tls_certificate_key", TLSCertificateKeyFilePassword: "tls_certificate_key_file_password", @@ -188,18 +186,16 @@ func TestAgentHelpers(t *testing.T) { }, }, &models.Agent{ - AgentID: "A10", - AgentType: models.MongoDBExporterType, - PMMAgentID: pointer.ToString("A10"), - RunsOnNodeID: nil, - NodeID: pointer.ToString("N1"), - ListenPort: pointer.ToUint16(8200), - TLS: true, - TLSSkipVerify: true, - ExporterOptions: &models.ExporterOptions{ - PushMetrics: false, - }, - MongoDBOptions: nil, // this test is specific for nil MongoDBOptions + AgentID: "A10", + AgentType: models.MongoDBExporterType, + PMMAgentID: pointer.ToString("A10"), + RunsOnNodeID: nil, + NodeID: pointer.ToString("N1"), + ListenPort: pointer.ToUint16(8200), + TLS: true, + TLSSkipVerify: true, + ExporterOptions: &models.ExporterOptions{}, + MongoDBOptions: nil, // this test is specific for nil MongoDBOptions }, } { require.NoError(t, q.Insert(str)) @@ -220,21 +216,19 @@ func TestAgentHelpers(t *testing.T) { require.NoError(t, err) expected := []*models.Agent{ { - CreatedAt: now, - UpdatedAt: now, - Status: models.AgentStatusUnknown, - AgentID: "A10", - AgentType: models.MongoDBExporterType, - PMMAgentID: pointer.ToString("A10"), - RunsOnNodeID: nil, - NodeID: pointer.ToString("N1"), - ListenPort: pointer.ToUint16(8200), - TLS: true, - TLSSkipVerify: true, - ExporterOptions: &models.ExporterOptions{ - PushMetrics: false, - }, - MongoDBOptions: nil, // this test is specific for nil MongoDBOptions + CreatedAt: now, + UpdatedAt: now, + Status: models.AgentStatusUnknown, + AgentID: "A10", + AgentType: models.MongoDBExporterType, + PMMAgentID: pointer.ToString("A10"), + RunsOnNodeID: nil, + NodeID: pointer.ToString("N1"), + ListenPort: pointer.ToUint16(8200), + TLS: true, + TLSSkipVerify: true, + ExporterOptions: &models.ExporterOptions{}, + MongoDBOptions: nil, // this test is specific for nil MongoDBOptions }, { AgentID: "A3", @@ -281,6 +275,9 @@ func TestAgentHelpers(t *testing.T) { ListenPort: pointer.ToUint16OrNil(8200), TLS: true, TLSSkipVerify: true, + ExporterOptions: &models.ExporterOptions{ + ExposeExporter: false, + }, MongoDBOptions: &models.MongoDBOptions{ TLSCertificateKey: "tls_certificate_key", TLSCertificateKeyFilePassword: "tls_certificate_key_file_password", @@ -292,16 +289,17 @@ func TestAgentHelpers(t *testing.T) { }, }, { - AgentID: "A9", - AgentType: "mongodb_exporter", - NodeID: pointer.ToStringOrNil("N1"), - PMMAgentID: pointer.ToStringOrNil("A9"), - CreatedAt: now, - UpdatedAt: now, - Status: models.AgentStatusUnknown, - ListenPort: pointer.ToUint16OrNil(8200), - TLS: true, - TLSSkipVerify: true, + AgentID: "A9", + AgentType: "mongodb_exporter", + NodeID: pointer.ToStringOrNil("N1"), + PMMAgentID: pointer.ToStringOrNil("A9"), + CreatedAt: now, + UpdatedAt: now, + Status: models.AgentStatusUnknown, + ListenPort: pointer.ToUint16OrNil(8200), + TLS: true, + TLSSkipVerify: true, + ExporterOptions: &models.ExporterOptions{}, MongoDBOptions: &models.MongoDBOptions{ TLSCertificateKey: "tls_certificate_key", TLSCertificateKeyFilePassword: "tls_certificate_key_file_password",