Add a slightly longer sleep to a test that waits for a timer to advance#7466
Merged
Add a slightly longer sleep to a test that waits for a timer to advance#7466
Conversation
The sign in spec changed in this commit waits for a timer to advance. It waits exactly 1 second, which near the boundaries of the current second can lead to an edge case that leads to the following failure:
```
Failures:
1) Sign in session approaches timeout user sees warning before session times out
Failure/Error: expect(time2).to be < time1
expected: < "14 minutes and 56 seconds"
got: "14 minutes and 56 seconds"
# ./spec/features/users/sign_in_spec.rb:274:in `block (3 levels) in <top (required)>'
# ./spec/rails_helper.rb:134:in `block (2 levels) in <top (required)>'
```
This commit modifies the sleep in this test to advance more than a second so that the assertion never runs near the boundary of the recent second.
[skip changelog]
jskinne3
approved these changes
Dec 9, 2022
Contributor
jskinne3
left a comment
There was a problem hiding this comment.
Best 2-byte commit ever
Contributor
|
I don't suppose there's any way to avoid a real-time |
Contributor
Author
|
I agree, but there isn't anything obvious since this is waiting on the timer in the JS running in chromedriver. This commit fixes the flaky test and trades a half second for not having to wait for an entire 1/11 of the suite re-run. |
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.
The sign in spec changed in this commit waits for a timer to advance. It waits exactly 1 second, which near the boundaries of the current second can lead to an edge case that leads to the following failure:
This commit modifies the sleep in this test to advance more than a second so that the assertion never runs near the boundary of the recent second.