Merged
Conversation
plutasnyy
approved these changes
Mar 1, 2019
Contributor
|
Update changelog pls ;) |
tkaik
approved these changes
Mar 7, 2019
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.
I fixed a SuiteRemoveConditionTest class which led to occasional tests failure.
Description
I noticed that running SuiteRemoveConditionTest caused different results each time. Out of 100 runs, 87 ended successfully and 13 failed. Each fail was caused from assertion error in
evaluate_when8SuitesRemoveOlderThanButAlwaysKeepLatestVersion_expectTrue()when testing the following suite list:A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; null ; C-5 ; 4.In this test we check if suite created 4 days ago is marked as "to be removed" if cleaner removes suites 4 days old and older.
The problem resulted from incorrect order of initalizations: first we create SuiteRemoveCondition with max acceptable timestamp (now minus 4 days) and then mocked Suite (with creation date: now minus 4 days). The offset between "now" value in these cases led to the Suite being considered younger than 4 days from the condition's perspective. The difference is so small that in some cases the test passes, but the bug is evident if you use a breakpoint between the two initializations (increasing the time difference - then it fails every time).
I changed the order in all methods to prevent future mistakes.
Types of changes
Checklist:
I hereby agree to the terms of the AET Contributor License Agreement.