Skip to content

Commit

Permalink
PMM-5086-12634 Fix agent management tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriCtvrtka committed Dec 3, 2024
1 parent 06bb86f commit 517eeb0
Showing 1 changed file with 134 additions and 20 deletions.
154 changes: 134 additions & 20 deletions managed/services/management/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,36 +148,78 @@ func TestAgentService(t *testing.T) {

expected := []*agentv1.UniversalAgent{
{
AgentId: pgExporterID,
AgentType: "postgres_exporter",
PmmAgentId: models.PMMServerAgentID,
IsConnected: false,
CreatedAt: timestamppb.New(now),
UpdatedAt: timestamppb.New(now),
Username: "postgres",
PostgresqlOptions: &agentv1.UniversalAgent_PostgreSQLOptions{
IsSslKeySet: false,
},
AgentId: pgExporterID,
AgentType: "postgres_exporter",
PmmAgentId: models.PMMServerAgentID,
IsConnected: false,
CreatedAt: timestamppb.New(now),
UpdatedAt: timestamppb.New(now),
Username: "postgres",
ServiceId: "00000000-0000-4000-8000-000000000002",
Status: "AGENT_STATUS_UNKNOWN",
Tls: true,
CommentsParsingDisabled: true,
},
{
AgentId: pgStatStatementID,
AgentType: "qan-postgresql-pgstatements-agent",
PmmAgentId: models.PMMServerAgentID,
IsConnected: false,
CreatedAt: timestamppb.New(now),
UpdatedAt: timestamppb.New(now),
Username: "postgres",
AzureOptions: &agentv1.UniversalAgent_AzureOptions{
ClientId: "",
IsClientSecretSet: false,
ResourceGroup: "",
SubscriptionId: "",
TenantId: "",
},
MongoDbOptions: &agentv1.UniversalAgent_MongoDBOptions{
IsTlsCertificateKeySet: false,
IsTlsCertificateKeyFilePasswordSet: false,
AuthenticationMechanism: "",
AuthenticationDatabase: "",
StatsCollections: nil,
CollectionsLimit: 0,
EnableAllCollectors: false,
},
MysqlOptions: &agentv1.UniversalAgent_MySQLOptions{
IsTlsKeySet: false,
},
PostgresqlOptions: &agentv1.UniversalAgent_PostgreSQLOptions{
IsSslKeySet: false,
IsSslKeySet: false,
AutoDiscoveryLimit: 0,
MaxExporterConnections: 0,
},
},
{
AgentId: pgStatStatementID,
AgentType: "qan-postgresql-pgstatements-agent",
PmmAgentId: models.PMMServerAgentID,
IsConnected: false,
CreatedAt: timestamppb.New(now),
UpdatedAt: timestamppb.New(now),
Username: "postgres",
ServiceId: "00000000-0000-4000-8000-000000000002",
Status: "AGENT_STATUS_UNKNOWN",
Tls: true,
CommentsParsingDisabled: true,
AzureOptions: &agentv1.UniversalAgent_AzureOptions{
ClientId: "",
IsClientSecretSet: false,
ResourceGroup: "",
SubscriptionId: "",
TenantId: "",
},
MongoDbOptions: &agentv1.UniversalAgent_MongoDBOptions{
IsTlsCertificateKeySet: false,
IsTlsCertificateKeyFilePasswordSet: false,
AuthenticationMechanism: "",
AuthenticationDatabase: "",
StatsCollections: nil,
CollectionsLimit: 0,
EnableAllCollectors: false,
},
MysqlOptions: &agentv1.UniversalAgent_MySQLOptions{
IsTlsKeySet: false,
},
PostgresqlOptions: &agentv1.UniversalAgent_PostgreSQLOptions{
IsSslKeySet: false,
AutoDiscoveryLimit: 0,
MaxExporterConnections: 0,
},
},
{
AgentId: models.PMMServerAgentID,
Expand All @@ -186,6 +228,30 @@ func TestAgentService(t *testing.T) {
IsConnected: true,
CreatedAt: timestamppb.New(now),
UpdatedAt: timestamppb.New(now),
AzureOptions: &agentv1.UniversalAgent_AzureOptions{
ClientId: "",
IsClientSecretSet: false,
ResourceGroup: "",
SubscriptionId: "",
TenantId: "",
},
MongoDbOptions: &agentv1.UniversalAgent_MongoDBOptions{
IsTlsCertificateKeySet: false,
IsTlsCertificateKeyFilePasswordSet: false,
AuthenticationMechanism: "",
AuthenticationDatabase: "",
StatsCollections: nil,
CollectionsLimit: 0,
EnableAllCollectors: false,
},
MysqlOptions: &agentv1.UniversalAgent_MySQLOptions{
IsTlsKeySet: false,
},
PostgresqlOptions: &agentv1.UniversalAgent_PostgreSQLOptions{
IsSslKeySet: false,
AutoDiscoveryLimit: 0,
MaxExporterConnections: 0,
},
},
}

Expand Down Expand Up @@ -237,6 +303,30 @@ func TestAgentService(t *testing.T) {
UpdatedAt: timestamppb.New(now),
ServiceId: "00000000-0000-4000-8000-000000000006",
Status: "AGENT_STATUS_UNKNOWN",
AzureOptions: &agentv1.UniversalAgent_AzureOptions{
ClientId: "",
IsClientSecretSet: false,
ResourceGroup: "",
SubscriptionId: "",
TenantId: "",
},
MongoDbOptions: &agentv1.UniversalAgent_MongoDBOptions{
IsTlsCertificateKeySet: false,
IsTlsCertificateKeyFilePasswordSet: false,
AuthenticationMechanism: "",
AuthenticationDatabase: "",
StatsCollections: nil,
CollectionsLimit: 0,
EnableAllCollectors: false,
},
MysqlOptions: &agentv1.UniversalAgent_MySQLOptions{
IsTlsKeySet: false,
},
PostgresqlOptions: &agentv1.UniversalAgent_PostgreSQLOptions{
IsSslKeySet: false,
AutoDiscoveryLimit: 0,
MaxExporterConnections: 0,
},
},
}
assert.Equal(t, expected, response.Agents)
Expand Down Expand Up @@ -287,6 +377,30 @@ func TestAgentService(t *testing.T) {
UpdatedAt: timestamppb.New(now),
ServiceId: "00000000-0000-4000-8000-000000000006",
Status: "AGENT_STATUS_UNKNOWN",
AzureOptions: &agentv1.UniversalAgent_AzureOptions{
ClientId: "",
IsClientSecretSet: false,
ResourceGroup: "",
SubscriptionId: "",
TenantId: "",
},
MongoDbOptions: &agentv1.UniversalAgent_MongoDBOptions{
IsTlsCertificateKeySet: false,
IsTlsCertificateKeyFilePasswordSet: false,
AuthenticationMechanism: "",
AuthenticationDatabase: "",
StatsCollections: nil,
CollectionsLimit: 0,
EnableAllCollectors: false,
},
MysqlOptions: &agentv1.UniversalAgent_MySQLOptions{
IsTlsKeySet: false,
},
PostgresqlOptions: &agentv1.UniversalAgent_PostgreSQLOptions{
IsSslKeySet: false,
AutoDiscoveryLimit: 0,
MaxExporterConnections: 0,
},
},
}
assert.Equal(t, expected, response.Agents)
Expand Down

0 comments on commit 517eeb0

Please sign in to comment.