Skip to content

Commit

Permalink
Add integration tests to check resource keys in bundle status
Browse files Browse the repository at this point in the history
  • Loading branch information
rubhanazeem committed Jun 20, 2024
1 parent 89daf98 commit 7b96567
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions integrationtests/controller/bundle/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,27 @@ var _ = Describe("Bundle Status Fields", func() {
if err != nil {
return err
}
resources := []v1alpha1.BundleDeploymentResource{}
resource := v1alpha1.BundleDeploymentResource{
Kind: "ConfigMap",
APIVersion: "v1",
Namespace: namespace,
Name: "app-config",
}
resources = append(resources, resource)
bd.Status.Display.State = "Ready"
bd.Status.AppliedDeploymentID = bd.Spec.DeploymentID
bd.Status.Ready = true
bd.Status.NonModified = true
bd.Status.Resources = resources
return k8sClient.Status().Update(ctx, bd)
}).ShouldNot(HaveOccurred())

err = k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: "name"}, bd)
Expect(err).NotTo(HaveOccurred())
Expect(bd.Status.Display.State).To(Equal("Ready"))
Expect(bd.Status.AppliedDeploymentID).To(Equal(bd.Spec.DeploymentID))
Expect(len(bd.Status.Resources)).To(Equal(1))

Eventually(func() bool {
err = k8sClient.Get(ctx, types.NamespacedName{Namespace: namespace, Name: "name"}, bundle)
Expand All @@ -89,6 +99,13 @@ var _ = Describe("Bundle Status Fields", func() {
}).Should(BeTrue())
Expect(bundle.Status.Summary.DesiredReady).To(Equal(1))
Expect(bundle.Status.Display.ReadyClusters).To(Equal("1/1"))
Expect(len(bundle.Status.ResourceKey)).To(Equal(1))
bdResource := bd.Status.Resources[0]
bundleResourceKey := bundle.Status.ResourceKey[0]
Expect(bundleResourceKey.APIVersion).To(Equal(bdResource.APIVersion))
Expect(bundleResourceKey.Name).To(Equal(bdResource.Name))
Expect(bundleResourceKey.Namespace).To(Equal(bdResource.Namespace))
Expect(bundleResourceKey.Kind).To(Equal(bdResource.Kind))
})
})

Expand Down

0 comments on commit 7b96567

Please sign in to comment.