Skip to content

Commit f8cfe95

Browse files
committed
Delete Prometheus namespace
1 parent 4a98e98 commit f8cfe95

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/framework/prometheus.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"github.com/prometheus/client_golang/api"
1414
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
1515
"github.com/prometheus/common/model"
16+
core "k8s.io/api/core/v1"
17+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1618
"k8s.io/client-go/rest"
1719
"sigs.k8s.io/controller-runtime/pkg/client"
1820
)
@@ -108,7 +110,7 @@ func InstallPrometheus(
108110
}
109111

110112
// UninstallPrometheus uninstalls Prometheus from the cluster.
111-
func UninstallPrometheus() error {
113+
func UninstallPrometheus(rm ResourceManager) error {
112114
output, err := exec.Command(
113115
"helm",
114116
"uninstall",
@@ -119,6 +121,16 @@ func UninstallPrometheus() error {
119121
return fmt.Errorf("failed to uninstall Prometheus: %w; output: %s", err, string(output))
120122
}
121123

124+
ns := &core.Namespace{
125+
ObjectMeta: metav1.ObjectMeta{
126+
Name: prometheusNamespace,
127+
},
128+
}
129+
130+
if err := rm.Delete([]client.Object{ns}); err != nil {
131+
return fmt.Errorf("failed to delete Prometheus namespace: %w", err)
132+
}
133+
122134
return nil
123135
}
124136

tests/suite/scale_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ var _ = Describe("Scale test", Ordered, Label("nfr", "scale"), func() {
706706

707707
AfterAll(func() {
708708
close(promPortForwardStopCh)
709-
Expect(framework.UninstallPrometheus()).To(Succeed())
709+
Expect(framework.UninstallPrometheus(resourceManager)).To(Succeed())
710710
Expect(outFile.Close()).To(Succeed())
711711

712712
// restoring NGF shared among tests in the suite

0 commit comments

Comments
 (0)