Skip to content

Commit

Permalink
PMM-12895 Fix API tests
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgavrilov committed Mar 7, 2024
1 parent e940c13 commit 54dda0b
Show file tree
Hide file tree
Showing 17 changed files with 400 additions and 0 deletions.
35 changes: 35 additions & 0 deletions api-tests/inventory/agents_azure_database_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ func TestAzureDatabaseExporter(t *testing.T) { //nolint:tparallel
"custom_label_azure_database_exporter": "azure_database_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyAzureDatabaseExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, getAgentRes)
Expand All @@ -84,6 +89,11 @@ func TestAzureDatabaseExporter(t *testing.T) { //nolint:tparallel
Common: &agents.ChangeAzureDatabaseExporterParamsBodyCommon{
Disable: true,
RemoveCustomLabels: true,
MetricsResolutions: &agents.ChangeAzureDatabaseExporterParamsBodyCommonMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
Context: pmmapitests.Context,
Expand All @@ -98,6 +108,11 @@ func TestAzureDatabaseExporter(t *testing.T) { //nolint:tparallel
AzureDatabaseSubscriptionID: "azure_subscription_id",
Disabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeAzureDatabaseExporterOKBodyAzureDatabaseExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeAzureDatabaseExporterOK)
Expand Down Expand Up @@ -127,6 +142,11 @@ func TestAzureDatabaseExporter(t *testing.T) { //nolint:tparallel
"new_label": "azure_database_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeAzureDatabaseExporterOKBodyAzureDatabaseExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeAzureDatabaseExporterOK)
Expand Down Expand Up @@ -244,6 +264,11 @@ func TestAzureDatabaseExporter(t *testing.T) { //nolint:tparallel
"custom_label_azure_database_exporter": "azure_database_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyAzureDatabaseExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, getAgentRes)
Expand All @@ -270,6 +295,11 @@ func TestAzureDatabaseExporter(t *testing.T) { //nolint:tparallel
"custom_label_azure_database_exporter": "azure_database_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeAzureDatabaseExporterOKBodyAzureDatabaseExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeAzureDatabaseExporterOK)
Expand All @@ -295,6 +325,11 @@ func TestAzureDatabaseExporter(t *testing.T) { //nolint:tparallel
"custom_label_azure_database_exporter": "azure_database_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeAzureDatabaseExporterOKBodyAzureDatabaseExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeAzureDatabaseExporterOK)
Expand Down
35 changes: 35 additions & 0 deletions api-tests/inventory/agents_external_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ func TestExternalExporter(t *testing.T) {
CustomLabels: map[string]string{
"custom_label_for_external_exporter": "external_exporter",
},
MetricsResolutions: &agents.GetAgentOKBodyExternalExporterMetricsResolutions{
Hr: "0s",
Mr: "0s",
Lr: "0s",
},
},
}, getAgentRes.Payload)
})
Expand Down Expand Up @@ -127,6 +132,11 @@ func TestExternalExporter(t *testing.T) {
CustomLabels: map[string]string{
"custom_label_external_exporter": "external_exporter",
},
MetricsResolutions: &agents.GetAgentOKBodyExternalExporterMetricsResolutions{
Hr: "0s",
Mr: "0s",
Lr: "0s",
},
},
}, getAgentRes.Payload)

Expand All @@ -152,6 +162,11 @@ func TestExternalExporter(t *testing.T) {
MetricsPath: "/metrics-hr",
ListenPort: 12345,
Disabled: true,
MetricsResolutions: &agents.ChangeExternalExporterOKBodyExternalExporterMetricsResolutions{
Hr: "0s",
Mr: "0s",
Lr: "0s",
},
},
}, changeExternalExporterOK.Payload)

Expand Down Expand Up @@ -181,6 +196,11 @@ func TestExternalExporter(t *testing.T) {
CustomLabels: map[string]string{
"new_label": "external_exporter",
},
MetricsResolutions: &agents.ChangeExternalExporterOKBodyExternalExporterMetricsResolutions{
Hr: "0s",
Mr: "0s",
Lr: "0s",
},
},
}, changeExternalExporterOK.Payload)
})
Expand Down Expand Up @@ -359,6 +379,11 @@ func TestExternalExporter(t *testing.T) {
"custom_label_for_external_exporter": "external_exporter",
},
PushMetricsEnabled: true,
MetricsResolutions: &agents.GetAgentOKBodyExternalExporterMetricsResolutions{
Hr: "0s",
Mr: "0s",
Lr: "0s",
},
},
}, getAgentRes.Payload)

Expand All @@ -385,6 +410,11 @@ func TestExternalExporter(t *testing.T) {
"custom_label_for_external_exporter": "external_exporter",
},
PushMetricsEnabled: false,
MetricsResolutions: &agents.ChangeExternalExporterOKBodyExternalExporterMetricsResolutions{
Hr: "0s",
Mr: "0s",
Lr: "0s",
},
},
}, changeExternalExporterOK.Payload)

Expand All @@ -410,6 +440,11 @@ func TestExternalExporter(t *testing.T) {
"custom_label_for_external_exporter": "external_exporter",
},
PushMetricsEnabled: true,
MetricsResolutions: &agents.ChangeExternalExporterOKBodyExternalExporterMetricsResolutions{
Hr: "0s",
Mr: "0s",
Lr: "0s",
},
},
}, changeExternalExporterOK.Payload)

Expand Down
30 changes: 30 additions & 0 deletions api-tests/inventory/agents_mongodb_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ func TestMongoDBExporter(t *testing.T) {
"new_label": "mongodb_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyMongodbExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, getAgentRes)
Expand All @@ -109,6 +114,11 @@ func TestMongoDBExporter(t *testing.T) {
PMMAgentID: pmmAgentID,
Disabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMongoDBExporterOKBodyMongodbExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeMongoDBExporterOK)
Expand Down Expand Up @@ -138,6 +148,11 @@ func TestMongoDBExporter(t *testing.T) {
"new_label": "mongodb_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMongoDBExporterOKBodyMongodbExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeMongoDBExporterOK)
Expand Down Expand Up @@ -311,6 +326,11 @@ func TestMongoDBExporter(t *testing.T) {
},
PushMetricsEnabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyMongodbExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, getAgentRes)
Expand All @@ -337,6 +357,11 @@ func TestMongoDBExporter(t *testing.T) {
"new_label": "mongodb_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMongoDBExporterOKBodyMongodbExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeMongoDBExporterOK)
Expand All @@ -363,6 +388,11 @@ func TestMongoDBExporter(t *testing.T) {
},
PushMetricsEnabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMongoDBExporterOKBodyMongodbExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeMongoDBExporterOK)
Expand Down
30 changes: 30 additions & 0 deletions api-tests/inventory/agents_mysqld_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func TestMySQLdExporter(t *testing.T) {
},
TablestatsGroupTableLimit: 2000,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyMysqldExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
}, getAgentRes.Payload)

Expand All @@ -111,6 +116,11 @@ func TestMySQLdExporter(t *testing.T) {
Disabled: true,
TablestatsGroupTableLimit: 2000,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMySQLdExporterOKBodyMysqldExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
}, changeMySQLdExporterOK.Payload)

Expand Down Expand Up @@ -139,6 +149,11 @@ func TestMySQLdExporter(t *testing.T) {
},
TablestatsGroupTableLimit: 2000,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMySQLdExporterOKBodyMysqldExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
}, changeMySQLdExporterOK.Payload)
})
Expand Down Expand Up @@ -368,6 +383,11 @@ func TestMySQLdExporter(t *testing.T) {
TablestatsGroupTableLimit: 2000,
PushMetricsEnabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyMysqldExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
}, getAgentRes.Payload)

Expand All @@ -393,6 +413,11 @@ func TestMySQLdExporter(t *testing.T) {
},
TablestatsGroupTableLimit: 2000,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMySQLdExporterOKBodyMysqldExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
}, changeMySQLdExporterOK.Payload)

Expand All @@ -418,6 +443,11 @@ func TestMySQLdExporter(t *testing.T) {
TablestatsGroupTableLimit: 2000,
PushMetricsEnabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeMySQLdExporterOKBodyMysqldExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
}, changeMySQLdExporterOK.Payload)
_, err = client.Default.Agents.ChangeMySQLdExporter(&agents.ChangeMySQLdExporterParams{
Expand Down
30 changes: 30 additions & 0 deletions api-tests/inventory/agents_node_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ func TestNodeExporter(t *testing.T) {
Disabled: false,
CustomLabels: customLabels,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyNodeExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, getAgentRes)
Expand All @@ -83,6 +88,11 @@ func TestNodeExporter(t *testing.T) {
PMMAgentID: pmmAgentID,
Disabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeNodeExporterOKBodyNodeExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeNodeExporterOK)
Expand Down Expand Up @@ -110,6 +120,11 @@ func TestNodeExporter(t *testing.T) {
"new_label": "node_exporter",
},
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeNodeExporterOKBodyNodeExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeNodeExporterOK)
Expand Down Expand Up @@ -184,6 +199,11 @@ func TestNodeExporter(t *testing.T) {
CustomLabels: customLabels,
PushMetricsEnabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.GetAgentOKBodyNodeExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, getAgentRes)
Expand All @@ -207,6 +227,11 @@ func TestNodeExporter(t *testing.T) {
Disabled: false,
CustomLabels: customLabels,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeNodeExporterOKBodyNodeExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeNodeExporterOK)
Expand All @@ -230,6 +255,11 @@ func TestNodeExporter(t *testing.T) {
CustomLabels: customLabels,
PushMetricsEnabled: true,
Status: &AgentStatusUnknown,
MetricsResolutions: &agents.ChangeNodeExporterOKBodyNodeExporterMetricsResolutions{
Hr: "0s",
Lr: "0s",
Mr: "0s",
},
},
},
}, changeNodeExporterOK)
Expand Down
Loading

0 comments on commit 54dda0b

Please sign in to comment.