From a487750b374b7c69fef1c8fee88af74c9cac8eb3 Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Mon, 22 May 2023 05:49:45 -0300 Subject: [PATCH] Test name colision between Prometheus Server and Agent (#5582) Signed-off-by: GitHub --- test/e2e/main_test.go | 1 + test/e2e/prometheusagent_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index 5fd180b53..9cdfc859e 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -290,6 +290,7 @@ func testAllNSPrometheus(t *testing.T) { "RelabelConfigCRDValidation": testRelabelConfigCRDValidation, "PromReconcileStatusWhenInvalidRuleCreated": testPromReconcileStatusWhenInvalidRuleCreated, "CreatePrometheusAgent": testCreatePrometheusAgent, + "PrometheusAgentAndServerNameColision": testAgentAndServerNameColision, } for name, f := range testFuncs { diff --git a/test/e2e/prometheusagent_test.go b/test/e2e/prometheusagent_test.go index 30becf2a1..74bf4c7d2 100644 --- a/test/e2e/prometheusagent_test.go +++ b/test/e2e/prometheusagent_test.go @@ -40,3 +40,32 @@ func testCreatePrometheusAgent(t *testing.T) { } } + +func testAgentAndServerNameColision(t *testing.T) { + t.Parallel() + + testCtx := framework.NewTestCtx(t) + defer testCtx.Cleanup(t) + + ns := framework.CreateNamespace(context.Background(), t, testCtx) + framework.SetupPrometheusRBAC(context.Background(), t, testCtx, ns) + name := "test" + + prometheusAgentCRD := framework.MakeBasicPrometheusAgent(ns, name, name, 1) + prometheusCRD := framework.MakeBasicPrometheus(ns, name, name, 1) + + if _, err := framework.CreatePrometheusAgentAndWaitUntilReady(context.Background(), ns, prometheusAgentCRD); err != nil { + t.Fatal(err) + } + if _, err := framework.CreatePrometheusAndWaitUntilReady(context.Background(), ns, prometheusCRD); err != nil { + t.Fatal(err) + } + + if err := framework.DeletePrometheusAgentAndWaitUntilGone(context.Background(), ns, name); err != nil { + t.Fatal(err) + } + if err := framework.DeletePrometheusAndWaitUntilGone(context.Background(), ns, name); err != nil { + t.Fatal(err) + } + +}