Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Fix RemoveFinalizerForBindings and RemoveBindingFinalizerByInstance tests #2591

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions pkg/svcat/service-catalog/binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,18 @@ var _ = Describe("Binding", func() {
}
Expect(err).NotTo(HaveOccurred())
Expect(bindings).Should(ConsistOf(expectedBindingsToDelete[0], expectedBindingsToDelete[1]))
// The first action should be a get call because RemoveFinalizerForBinding calls RetrieveBinding to retrieve the ServiceBinding object
Expect(svcCatClient.Actions()[0].Matches("get", "servicebindings")).To(BeTrue())
Expect(svcCatClient.Actions()[1].Matches("update", "servicebindings")).To(BeTrue())
// Two of the actions should be get calls and the other two should be update calls
numGetCalls := 0
numUpdateCalls := 0
for _, action := range svcCatClient.Actions() {
if action.Matches("get", "servicebindings") {
numGetCalls++
} else if action.Matches("update", "servicebindings") {
numUpdateCalls++
}
}
Expect(numGetCalls).To(Equal(2))
Expect(numUpdateCalls).To(Equal(2))
})
It("Bubbles up errors", func() {
badClient := &fake.Clientset{}
Expand All @@ -379,9 +388,6 @@ var _ = Describe("Binding", func() {
Expect(bindings).To(BeNil())
Expect(err).To(HaveOccurred())
Expect(err.Error()).Should(ContainSubstring(errorMessage))
// The first action should be a get call because RemoveFinalizerForBinding calls RetrieveBinding to retrieve the ServiceBinding object
Expect(badClient.Actions()[0].Matches("get", "servicebindings")).To(BeTrue())
Expect(badClient.Actions()[1].Matches("update", "servicebindings")).To(BeTrue())
})
})

Expand Down