From eea75177ec3aaa05739db706dbd475db8ddbb4a0 Mon Sep 17 00:00:00 2001 From: Yang Song Date: Wed, 30 Oct 2024 15:00:12 -0400 Subject: [PATCH] Fix --- .../tests/otel/otel-agent/no_dd_exporter_test.go | 11 +---------- test/new-e2e/tests/otel/utils/config_utils.go | 16 +++++++++------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go index 10c1bce4d2319..cbfe4529ae90e 100644 --- a/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go +++ b/test/new-e2e/tests/otel/otel-agent/no_dd_exporter_test.go @@ -49,14 +49,5 @@ func (s *noDDExporterTestSuite) TestOTelAgentInstalled() { } func (s *noDDExporterTestSuite) TestFlare() { - expectedContents := []string{ - "otel-agent", - "ddflare/dd-autoconfigured:", - "health_check/dd-autoconfigured:", - "pprof/dd-autoconfigured:", - "zpages/dd-autoconfigured:", - "infraattributes/dd-autoconfigured:", - "prometheus/dd-autoconfigured:", - } - utils.TestOTelFlare(s, expectedContents) + utils.TestOTelFlare(s, "", "", "") } diff --git a/test/new-e2e/tests/otel/utils/config_utils.go b/test/new-e2e/tests/otel/utils/config_utils.go index 8d94e3888c7f2..9a19def49c2e3 100644 --- a/test/new-e2e/tests/otel/utils/config_utils.go +++ b/test/new-e2e/tests/otel/utils/config_utils.go @@ -135,13 +135,15 @@ func validateConfigs(t *testing.T, expectedCfg string, actualCfg string) { // Traces, metrics and logs endpoints are set dynamically to the fake intake address in the config // These endpoints vary from test to test and should be ignored in the comparison exps, _ := actualConfRaw["exporters"].(map[string]any) - ddExp, _ := exps["datadog"].(map[string]any) - tcfg := ddExp["traces"].(map[string]any) - delete(tcfg, "endpoint") - mcfg := ddExp["metrics"].(map[string]any) - delete(mcfg, "endpoint") - lcfg := ddExp["logs"].(map[string]any) - delete(lcfg, "endpoint") + if ddExp, ok := exps["datadog"]; ok { + ddExpCfg := ddExp.(map[string]any) + tcfg := ddExpCfg["traces"].(map[string]any) + delete(tcfg, "endpoint") + mcfg := ddExpCfg["metrics"].(map[string]any) + delete(mcfg, "endpoint") + lcfg := ddExpCfg["logs"].(map[string]any) + delete(lcfg, "endpoint") + } actualCfgBytes, err := yaml.Marshal(actualConfRaw) require.NoError(t, err)