-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathcleanup_test.go
86 lines (60 loc) · 2.73 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
//go:build e2e
// +build e2e
package utils
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
. "github.com/kedacore/keda/v2/tests/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)
KubeClient = GetKubernetesClient(t)
DeleteNamespace(t, KubeClient, 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)
KubeClient = GetKubernetesClient(t)
DeleteNamespace(t, KubeClient, 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)
KubeClient = GetKubernetesClient(t)
DeleteNamespace(t, KubeClient, 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)
KubeClient = GetKubernetesClient(t)
DeleteNamespace(t, KubeClient, GcpIdentityNamespace)
}
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)
KubeClient = GetKubernetesClient(t)
DeleteNamespace(t, KubeClient, CertManagerNamespace)
}