Skip to content

Commit 8c27720

Browse files
author
Jake
committed
unpend profiles test and cleanup finalizers
1 parent d73f943 commit 8c27720

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

test/acceptance/test/profiles_test.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"sigs.k8s.io/controller-runtime/pkg/client"
2929
)
3030

31-
var _ = PDescribe("Weave GitOps Profiles API", func() {
31+
var _ = Describe("Weave GitOps Profiles API", func() {
3232
var (
3333
namespace = "test-namespace"
3434
clusterName string
@@ -58,12 +58,9 @@ var _ = PDescribe("Weave GitOps Profiles API", func() {
5858
})
5959

6060
AfterEach(func() {
61-
session := runCommandAndReturnSessionOutput(fmt.Sprintf("kubectl -n %s delete kustomizations --all", namespace))
62-
Eventually(session, "20s", "1s").Should(gexec.Exit(0))
63-
session = runCommandAndReturnSessionOutput(fmt.Sprintf("kubectl -n %s delete gitrepositories --all", namespace))
64-
Eventually(session, "20s", "1s").Should(gexec.Exit(0))
65-
deleteWorkload(profileName, namespace)
61+
cleanupFinalizers(clusterName, namespace)
6662
deleteRepo(tip.appRepoName, gitproviders.GitProviderGitHub, githubOrg)
63+
deleteNamespace(namespace)
6764
})
6865

6966
It("gets deployed and is accessible via the service", func() {
@@ -154,6 +151,19 @@ Namespace: %s`, clusterName, namespace)))
154151
})
155152
})
156153

154+
func cleanupFinalizers(clusterName, namespace string) {
155+
session := runCommandAndReturnSessionOutput(fmt.Sprintf("%s flux suspend kustomization -n %s %s-system", gitopsBinaryPath, namespace, clusterName))
156+
Eventually(session, "60s", "1s").Should(gexec.Exit(0))
157+
session = runCommandAndReturnSessionOutput(fmt.Sprintf("kubectl -n %s delete helmreleases --all --wait", namespace))
158+
Eventually(session, "60s", "1s").Should(gexec.Exit(0))
159+
session = runCommandAndReturnSessionOutput(fmt.Sprintf("kubectl -n %s delete helmrepositories --all --wait", namespace))
160+
Eventually(session, "60s", "1s").Should(gexec.Exit(0))
161+
session = runCommandAndReturnSessionOutput(fmt.Sprintf("kubectl -n %s delete kustomizations --all --wait", namespace))
162+
Eventually(session, "60s", "1s").Should(gexec.Exit(0))
163+
session = runCommandAndReturnSessionOutput(fmt.Sprintf("kubectl -n %s delete gitrepositories --all --wait", namespace))
164+
Eventually(session, "60s", "1s").Should(gexec.Exit(0))
165+
}
166+
157167
func buildKubernetesClients() (*kubernetes.Clientset, client.Client) {
158168
config, err := clientcmd.BuildConfigFromFlags("", filepath.Join(homedir.HomeDir(), ".kube", "config"))
159169
Expect(err).NotTo(HaveOccurred())

test/acceptance/test/scripts/kind-cluster.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ kind delete clusters --all
2525
echo "Create a new kind cluster with name "$1
2626

2727
# desired cluster name; default is "kind"
28-
KIND_CLUSTER_NAME=$1
28+
KIND_CLUSTER_NAME="${1:-kind}"
2929
KIND_CLUSTER_OPTS="--name ${KIND_CLUSTER_NAME}"
3030

3131
if [ -n "${2}" ]; then

0 commit comments

Comments
 (0)