Skip to content

Commit

Permalink
Fix wrong usage of when and two opposites it
Browse files Browse the repository at this point in the history
Clearer usage of when with it for success and failure scenarios of UT
  • Loading branch information
razo7 committed May 31, 2023
1 parent 123d110 commit f96bd13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion controllers/fenceagentsremediation_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ var _ = Describe("FAR Controller", func() {
_, err := buildFenceAgentParams(underTestFAR)
Expect(err).To(HaveOccurred())
})
})
When("FAR's name does match a node name", func() {
It("should succeed", func() {
underTestFAR.ObjectMeta.Name = validNodeName
_, err := buildFenceAgentParams(underTestFAR)
Expand All @@ -95,10 +97,12 @@ var _ = Describe("FAR Controller", func() {
AfterEach(func() {
Expect(k8sClient.Delete(context.Background(), node)).To(Succeed())
})
When("FAR's name doesn't match an existing node name", func() {
When("FAR's name doesn't match to an existing node name", func() {
It("should fail", func() {
Expect(farUtils.CheckNodeName(k8sClient, dummyNodeName)).To(HaveOccurred())
})
})
When("FAR's name does match to an existing node name", func() {
It("should succeed", func() {
Expect(farUtils.CheckNodeName(k8sClient, validNodeName)).To(Succeed())
})
Expand Down

0 comments on commit f96bd13

Please sign in to comment.