Skip to content

Commit

Permalink
Fix Integration Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Boomatang committed Jan 18, 2024
1 parent 53a709c commit 885eb2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 6 additions & 2 deletions controllers/gateway_kuadrant_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,21 @@ var _ = Describe("Kuadrant Gateway controller", func() {
})

Context("Two kuadrant instances", func() {
var secondNamespace string

BeforeEach(func() {
CreateNamespace(&secondNamespace)
newKuadrantName := "second"
newKuadrant := &kuadrantv1beta1.Kuadrant{
TypeMeta: metav1.TypeMeta{APIVersion: "v1beta1", Kind: "Kuadrant"},
ObjectMeta: metav1.ObjectMeta{Name: newKuadrantName, Namespace: testNamespace},
ObjectMeta: metav1.ObjectMeta{Name: newKuadrantName, Namespace: secondNamespace},
}
err := testClient().Create(context.Background(), newKuadrant)
Expect(err).ToNot(HaveOccurred())

Eventually(func() bool {
kuadrant := &kuadrantv1beta1.Kuadrant{}
err := k8sClient.Get(context.Background(), client.ObjectKey{Name: newKuadrantName, Namespace: testNamespace}, kuadrant)
err := k8sClient.Get(context.Background(), client.ObjectKey{Name: newKuadrantName, Namespace: secondNamespace}, kuadrant)
if err != nil {
return false
}
Expand All @@ -92,6 +94,8 @@ var _ = Describe("Kuadrant Gateway controller", func() {
}, time.Minute, 5*time.Second).Should(BeTrue())
})

AfterEach(DeleteNamespaceCallback(&secondNamespace))

It("new gateway should not be annotated", func() {
gateway := testBuildBasicGateway(gwName, testNamespace)
err := k8sClient.Create(context.Background(), gateway)
Expand Down
5 changes: 1 addition & 4 deletions controllers/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ func CreateNamespace(namespace *string) {
existingNamespace := &v1.Namespace{}
Eventually(func() bool {
err := testClient().Get(context.Background(), types.NamespacedName{Name: generatedTestNamespace}, existingNamespace)
if err != nil {
return false
}
return true
return err == nil
}, time.Minute, 5*time.Second).Should(BeTrue())

*namespace = existingNamespace.Name
Expand Down

0 comments on commit 885eb2d

Please sign in to comment.