Skip to content

Commit

Permalink
fix(tests): cleaning up protected tenant upon test success
Browse files Browse the repository at this point in the history
  • Loading branch information
prometherion committed Jun 9, 2022
1 parent 4f55dd8 commit e0b339d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions e2e/tenant_protected_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"

capsulev1beta1 "github.com/clastix/capsule/api/v1beta1"
)
Expand All @@ -33,6 +34,13 @@ var _ = Describe("Deleting a tenant with protected annotation", func() {
},
}

JustAfterEach(func() {
Expect(k8sClient.Get(context.TODO(), types.NamespacedName{Name: tnt.GetName()}, tnt)).Should(Succeed())
tnt.SetAnnotations(map[string]string{})
Expect(k8sClient.Update(context.TODO(), tnt)).Should(Succeed())
Expect(k8sClient.Delete(context.TODO(), tnt)).Should(Succeed())
})

It("should fail", func() {
Expect(k8sClient.Create(context.TODO(), tnt)).Should(Succeed())
Expect(k8sClient.Delete(context.TODO(), tnt)).ShouldNot(Succeed())
Expand Down

0 comments on commit e0b339d

Please sign in to comment.