Skip to content

Commit

Permalink
added dmm ready test function
Browse files Browse the repository at this point in the history
Signed-off-by: Blake Devcich <[email protected]>
  • Loading branch information
bdevcich committed Nov 8, 2023
1 parent 0824a61 commit 96ef303
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
9 changes: 1 addition & 8 deletions internal/controller/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1004,14 +1004,7 @@ var _ = Describe("Integration Test", func() {

By("Creating the DataMovementManager")
Expect(k8sClient.Create(context.TODO(), dmm)).To(Succeed())

Eventually(func(g Gomega) bool {
g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)).To(Succeed())
dmm.Status.Ready = true
g.Expect(k8sClient.Status().Update(context.TODO(), dmm)).To(Succeed())
g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)).To(Succeed())
return dmm.Status.Ready
}).Should(BeTrue())
WaitForDMMReady(dmm)

/*************************** Proposal ****************************/

Expand Down
21 changes: 12 additions & 9 deletions internal/controller/nnf_workflow_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,7 @@ var _ = Describe("NNF Workflow Unit Tests", func() {
},
}
Expect(k8sClient.Create(ctx, dmm)).To(Succeed())

Eventually(func(g Gomega) bool {
g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)).To(Succeed())
dmm.Status.Ready = true
g.Expect(k8sClient.Status().Update(context.TODO(), dmm)).To(Succeed())
g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)).To(Succeed())
return dmm.Status.Ready
}).Should(BeTrue())

WaitForDMMReady(dmm)
})

BeforeEach(func() {
Expand Down Expand Up @@ -1443,3 +1435,14 @@ var _ = Describe("NnfStorageProfile Webhook test", func() {
Expect(createNnfStorageProfile(profileInvalid, false)).To(BeNil())
})
})

func WaitForDMMReady(dmm *nnfv1alpha1.DataMovementManager) {
Eventually(func(g Gomega) bool {
g.Expect(k8sClient.Get(context.TODO(), client.ObjectKeyFromObject(dmm), dmm)).To(Succeed())
if !dmm.Status.Ready {
dmm.Status.Ready = true
g.Expect(k8sClient.Status().Update(context.TODO(), dmm)).To(Succeed())
}
return dmm.Status.Ready
}).Should(BeTrue())
}

0 comments on commit 96ef303

Please sign in to comment.