Skip to content

Commit

Permalink
Merge pull request #61 from elmiko/fix-temrination-handler-unit-tests
Browse files Browse the repository at this point in the history
OCPBUGS-20267: update bad url endpoint termination handler test
  • Loading branch information
openshift-ci[bot] committed Oct 10, 2023
2 parents 8ab5702 + bdce808 commit 694ecc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/termination/termination_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ var _ = Describe("Handler Suite", func() {
var counter int32

BeforeEach(func() {
counter = 0
// Ensure the polling logic is excercised in tests
httpHandler = newMockHTTPHandler(func(rw http.ResponseWriter, req *http.Request) {
if atomic.LoadInt32(&counter) == 4 {
Expand Down Expand Up @@ -162,14 +163,19 @@ var _ = Describe("Handler Suite", func() {

Context("and the instance termination notice is not fulfilled", func() {
BeforeEach(func() {
httpHandler = newMockHTTPHandler(notPreempted)
httpHandler = newMockHTTPHandler(func(rw http.ResponseWriter, req *http.Request) {
atomic.AddInt32(&counter, 1)
notPreempted(rw, req)
})
})

It("should not mark the node for deletion", func() {
Consistently(nodeMarkedForDeletion(testNode.Name)).Should(BeFalse())
})
})
})

Context("when the termination endpoint is invalid", func() {
Context("and the poll URL cannot be reached", func() {
BeforeEach(func() {
h.pollURL = &url.URL{Opaque: "abc#1://localhost"}
Expand Down

0 comments on commit 694ecc3

Please sign in to comment.