Skip to content

Commit

Permalink
Enable skipped tests to close #3847
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
  • Loading branch information
simonpasquier committed Sep 8, 2023
1 parent e8d57ce commit ae11f2a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 31 deletions.
38 changes: 17 additions & 21 deletions test/e2e/alertmanager_instance_namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,28 +247,24 @@ func testAlertmanagerInstanceNamespacesAllowList(t *testing.T) {
t.Fatalf("failed to wait for alertmanager config: %v", err)
}

// FIXME(simonpasquier): the unprivileged namespace lister/watcher
// isn't notified of updates properly so the code below fails.
// Uncomment the test once the lister/watcher is fixed.
//
// Remove the selecting label on the "allowed" namespace and check that
// the alertmanager configuration is updated.
// See https://github.com/prometheus-operator/prometheus-operator/issues/3847
//if err := framework.RemoveLabelsFromNamespace(allowedNs, "monitored"); err != nil {
// t.Fatal(err)
//}

//err = framework.PollAlertmanagerConfiguration(instanceNs, "instance",
// func(config string) error {
// if strings.Contains(config, "void") {
// return fmt.Errorf("expected generated configuration to not contain %q but got %q", "void", config)
// }

// return nil
// },
//)

//if err != nil {
// t.Fatalf("failed to wait for alertmanager config: %v", err)
//}
if err := framework.RemoveLabelsFromNamespace(context.Background(), allowedNs, "monitored"); err != nil {
t.Fatal(err)
}

err = framework.PollAlertmanagerConfiguration(context.Background(), instanceNs, "instance",
func(config string) error {
if strings.Contains(config, "void") {
return fmt.Errorf("expected generated configuration to not contain %q but got %q", "void", config)
}

return nil
},
)

if err != nil {
t.Fatalf("failed to wait for alertmanager config: %v", err)
}
}
16 changes: 6 additions & 10 deletions test/e2e/prometheus_instance_namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,16 @@ func testPrometheusInstanceNamespacesAllowList(t *testing.T) {
t.Fatal(err)
}

// FIXME(simonpasquier): the unprivileged namespace lister/watcher
// isn't notified of updates properly so the code below fails.
// Uncomment the test once the lister/watcher is fixed.
//
// Remove the selecting label on the "allowed" namespace and check that
// the target is removed.
// See https://github.com/prometheus-operator/prometheus-operator/issues/3847
//if err := testFramework.RemoveLabelsFromNamespace(framework.KubeClient, allowedNs, "monitored"); err != nil {
// t.Fatal(err)
//}
if err := framework.RemoveLabelsFromNamespace(context.Background(), allowedNs, "monitored"); err != nil {
t.Fatal(err)
}

//if err := framework.WaitForActiveTargets(instanceNs, "prometheus-instance", 0); err != nil {
// t.Fatal(err)
//}
if err := framework.WaitForActiveTargets(context.Background(), instanceNs, "prometheus-instance", 0); err != nil {
t.Fatal(err)
}
}

// this is not ideal, as we cannot really find out if prometheus operator did not reconcile the denied prometheus.
Expand Down

0 comments on commit ae11f2a

Please sign in to comment.