Skip to content

Conversation

@JoelSpeed
Copy link

This PR ensures that we use an independent scheme for the test setup so that the scheme registration in the NewHandler method is being tested.

This also refactors the tests slightly to ensure that we don't start the handler for tests where we aren't checking it's running, because this was cause races.

Note for reviewers: This PR is best reviewed with whitespace changes turned off

@JoelSpeed
Copy link
Author

/retest

@enxebre
Copy link
Member

enxebre commented Jul 16, 2020

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: enxebre

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 16, 2020
@JoelSpeed
Copy link
Author

/retest

httpHandler = nil
nodeName = "test-node"
httpHandler = newMockHTTPHandler(notFoundFunc)
stop = nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this should be the fix for unit flakes, re: #340 (comment)

Copy link

@Danil-Grigorev Danil-Grigorev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some comments on possible places for race conditions

Context("and the instance termination endpoint returns an unknown status", func() {
BeforeEach(func() {
httpHandler = newMockHTTPHandler(func(rw http.ResponseWriter, req *http.Request) {
if counter == 4 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@JoelSpeed JoelSpeed Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! This was actually in the existing code, I've just changed the indentation, but will fix

if counter == 4 {
rw.WriteHeader(500)
} else {
counter++

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use atomic incrementer here as well?

@Danil-Grigorev
Copy link

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 29, 2020
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 679ccd8 into openshift:master Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants