-
Notifications
You must be signed in to change notification settings - Fork 188
test: fix ctx timeout in advance before test success in ut #2189
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
data race in here
|
/verify |
this race on |
/verify |
fix testMaster.TestAgentPool in e3aae85 |
@@ -99,4 +99,6 @@ func (t *testElectionSuite) TestFailToStartLeader(c *check.C) { | |||
_, leaderID, _, err = s2.election.LeaderInfo(ctx) | |||
c.Assert(err, check.IsNil) | |||
c.Assert(leaderID, check.Equals, cfg2.Name) | |||
|
|||
cancel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cancal is redundant, already called defer cancel()
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, the current test case relies on ctx.cancel()
to exit and if ctx doesn't cancel, the test will never end (dm-master's server is keep running in backgroud)🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
means upper defer stack relies on context cancel
/merge |
This pull request has been accepted and is ready to merge. Commit hash: e3aae85
|
In response to a cherrypick label: new pull request created: #2191. |
What problem does this PR solve?
part of #2073
What is changed and how it works?
as title
Check List
Tests
Code changes
Side effects
Related changes