forked from kedacore/keda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup_test.go
93 lines (71 loc) · 3.29 KB
/
cleanup_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//go:build e2e
// +build e2e
package utils
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
. "github.com/kedacore/keda/v2/tests/helper"
"github.com/kedacore/keda/v2/tests/utils/helper"
)
func TestRemoveKEDA(t *testing.T) {
out, err := ExecuteCommandWithDir("make undeploy", "../..")
require.NoErrorf(t, err, "error removing KEDA - %s", err)
t.Log(string(out))
t.Log("KEDA removed successfully using 'make undeploy' command")
}
func TestRemoveAadPodIdentityComponents(t *testing.T) {
if AzureRunAadPodIdentityTests == "" || AzureRunAadPodIdentityTests == StringFalse {
t.Skip("skipping as aad pod identity tests are disabled")
}
_, err := ExecuteCommand(fmt.Sprintf("helm uninstall aad-pod-identity --namespace %s", AzureAdPodIdentityNamespace))
require.NoErrorf(t, err, "cannot uninstall aad pod identity webhook - %s", err)
DeleteNamespace(t, AzureAdPodIdentityNamespace)
}
func TestRemoveWorkloadIdentityComponents(t *testing.T) {
if AzureRunWorkloadIdentityTests == "" || AzureRunWorkloadIdentityTests == StringFalse {
t.Skip("skipping as workload identity tests are disabled")
}
_, err := ExecuteCommand(fmt.Sprintf("helm uninstall workload-identity-webhook --namespace %s", AzureWorkloadIdentityNamespace))
require.NoErrorf(t, err, "cannot uninstall workload identity webhook - %s", err)
DeleteNamespace(t, AzureWorkloadIdentityNamespace)
}
func TestRemoveAwsIdentityComponents(t *testing.T) {
if AwsIdentityTests == "" || AwsIdentityTests == StringFalse {
t.Skip("skipping as workload identity tests are disabled")
}
_, err := ExecuteCommand(fmt.Sprintf("helm uninstall aws-identity-webhook --namespace %s", AwsIdentityNamespace))
require.NoErrorf(t, err, "cannot uninstall workload identity webhook - %s", err)
DeleteNamespace(t, AwsIdentityNamespace)
}
func TestRemoveGcpIdentityComponents(t *testing.T) {
if GcpIdentityTests == "" || GcpIdentityTests == StringFalse {
t.Skip("skipping as workload identity tests are disabled")
}
_, err := ExecuteCommand(fmt.Sprintf("helm uninstall gcp-identity-webhook --namespace %s", GcpIdentityNamespace))
require.NoErrorf(t, err, "cannot uninstall workload identity webhook - %s", err)
DeleteNamespace(t, GcpIdentityNamespace)
}
func TestRemoveOpentelemetryComponents(t *testing.T) {
_, err := ExecuteCommand(fmt.Sprintf("helm uninstall opentelemetry-collector --namespace %s", OpentelemetryNamespace))
require.NoErrorf(t, err, "cannot uninstall opentelemetry-collector - %s", err)
DeleteNamespace(t, OpentelemetryNamespace)
}
func TestRemoveCertManager(t *testing.T) {
if !InstallCertManager {
t.Skip("skipping as cert manager isn't required")
}
_, err := ExecuteCommand(fmt.Sprintf("helm uninstall cert-manager --namespace %s", CertManagerNamespace))
require.NoErrorf(t, err, "cannot uninstall cert-manager - %s", err)
DeleteNamespace(t, CertManagerNamespace)
}
func TestRemoveAzureManagedPrometheusComponents(t *testing.T) {
KubectlDeleteWithTemplate(t, helper.EmptyTemplateData{}, "azureManagedPrometheusConfigMapTemplate", helper.AzureManagedPrometheusConfigMapTemplate)
}
func TestRemoveStrimzi(t *testing.T) {
_, err := ExecuteCommand(fmt.Sprintf(`helm uninstall --namespace %s %s`,
StrimziNamespace,
StrimziChartName))
require.NoErrorf(t, err, "cannot uninstall strimzi - %s", err)
DeleteNamespace(t, StrimziNamespace)
}