Skip to content

Commit

Permalink
Merge pull request #958 from weaveworks/947-fix-test-201
Browse files Browse the repository at this point in the history
fix: controller test 201 and fix test clean-up
  • Loading branch information
yitsushi committed Sep 13, 2023
2 parents 856cbf8 + 99da532 commit aca6f62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion controllers/cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func waitResourceToBeDelete(g gomega.Gomega, resource client.Object) {
return k8sClient.Get(ctx, key, resource)
}, cleanupTimeoutSeconds, interval).ShouldNot(gomega.Succeed())

if resource.GetObjectKind().GroupVersionKind().Kind == infrav1.TerraformKind {
if _, ok := resource.(*infrav1.Terraform); ok {
waitDefaultSecretsToBeDeletedForTerraform(g, resource)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build flaky

package controllers

import (
Expand Down Expand Up @@ -44,7 +42,7 @@ func Test_000201_auto_approve_with_disabled_drift_detection(t *testing.T) {
},
}
g.Expect(k8sClient.Create(ctx, &testRepo)).Should(Succeed())
defer func() { g.Expect(k8sClient.Delete(ctx, &testRepo)).Should(Succeed()) }()
defer waitResourceToBeDelete(g, &testRepo)

By("setting the git repo status object, the URL, and the correct checksum")
testRepo.Status = sourcev1.GitRepositoryStatus{
Expand Down Expand Up @@ -101,7 +99,7 @@ func Test_000201_auto_approve_with_disabled_drift_detection(t *testing.T) {
},
}
g.Expect(k8sClient.Create(ctx, &helloWorldTF)).Should(Succeed())
defer func() { g.Expect(k8sClient.Delete(ctx, &helloWorldTF)).Should(Succeed()) }()
defer waitResourceToBeDelete(g, &helloWorldTF)

By("checking that the hello world TF gets created")
helloWorldTFKey := types.NamespacedName{Namespace: "flux-system", Name: terraformName}
Expand Down

0 comments on commit aca6f62

Please sign in to comment.