[tests] Fix flakey TestAgentRegistersSessionsWithSessionTracker test.#2252
Merged
Merged
Conversation
…cker, if any, gets notified that a session is established. This would periodically cause TestAgentRegistersSessionsWithSessionTracker to fail because it would wait until the node was ready and then see if the tracker had been notified, and sometimes that happened in the reverse order. This PR also injects the testCA's context into all the agent calls so that better logging can be included. Signed-off-by: Ying Li <ying.li@docker.com>
Codecov Report
@@ Coverage Diff @@
## master #2252 +/- ##
==========================================
- Coverage 66.63% 60.46% -6.18%
==========================================
Files 92 124 +32
Lines 13480 20248 +6768
==========================================
+ Hits 8983 12243 +3260
- Misses 3550 6635 +3085
- Partials 947 1370 +423 |
Collaborator
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
agent.go, the ready channel is closed before the agent session tracker, if any, gets notified that a session is established. This would periodically causeTestAgentRegistersSessionsWithSessionTrackerto fail because it would wait until the node was ready and then see if the tracker had been notified, and sometimes that happened in the reverse order.This PR also injects the testCA's context into all the agent calls so that better logging can be included.
Signed-off-by: Ying Li ying.li@docker.com
The other option as opposed to polling in the test is, in the agent, to make the session tracker get called before the ready channel is closed, but perhaps closing the channel as soon as the agent was ready rather than waiting on any tracker code, which may be slow, might be better?
Fixes #2225.