knative / knative/pkg

Inconsistency with wait.PollImmediate and WaitForEndpointState

Open
#2,407 9 comments 0 reactions 0 assignees View on GitHub
lifecycle/frozen
Dominant language
Go
Stars
276
Forks
343
Avg merge
1d 1h
Merged PRs (30d)
1

Description

/area test-and-release
/kind bug
## Expected Behavior
`wait.PollImmediate` should keep on polling if I pass response checkers through `WaitForEndpointState` https://github.com/knative/pkg/blob/main/test/request.go#L78 until the state is reached or timeout happens.
## Actual Behavior
Since the response checkers for example: https://github.com/knative/pkg/blob/main/test/spoof/response_checks.go#L33 returns true or error, it makes `wait.PollImmediate` stop polling, that is - only the first endpoint state is checked.

## Additional Info
Apologies if I am reading the code wrong, but if this really is an inconsistency, I think the return should be changed to `false, nil` (in the statuscode check function as well), this makes sense according to me because anyway `WaitForEndpointState` is the only function which is propogating the response checkers to the Poll method, for `CheckEndpointState` its defaulted to `true, nil` and it makes sense because this method's scope is to just check once. If this reasoning makes sense, I can create a PR.

Contributor guide

Open the contributing guide

Research direction

Start with test/request.go at WaitForEndpointState and compare its use of wait.PollImmediate with CheckEndpointState. Read test/spoof/response_checks.go, including the response checker behavior, and trace the status-code check. Done means endpoint states continue being checked until the target state or timeout, with relevant tests confirming the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.