-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Random Failing UIEditWorkingSetWizardAuto.testEditPage #275 #1803
Fix Random Failing UIEditWorkingSetWizardAuto.testEditPage #275 #1803
Conversation
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.
Great to see this test failure being addressed, thank you! I have some questions/comments on the proposed fix.
....eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java
Outdated
Show resolved
Hide resolved
....eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java
Outdated
Show resolved
Hide resolved
....eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java
Outdated
Show resolved
Hide resolved
4759747
to
ded182d
Compare
In 2000 consecutive runs, the error did not occur. If you try this yourself: there is an error occurring on the second run of the test: This fail ALWAYS happens, ALWAYS on the second run of the series and NEVER in another place - I do not believe it to be worth our time since it is almost certainly related to having multiple runs back-to-back instead of running the test once (as it is intended to be). Additionally, the test is now much faster, taking about 0.25s on average |
Random Failing test documented here: #1005 |
ded182d
to
761cffd
Compare
I believe the fix to be more adequate now |
....eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java
Outdated
Show resolved
Hide resolved
...lipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIEditWorkingSetWizardAuto.java
Outdated
Show resolved
Hide resolved
...lipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIEditWorkingSetWizardAuto.java
Outdated
Show resolved
Hide resolved
8bb3de7
to
60d6f37
Compare
60d6f37
to
681b3a8
Compare
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.
You should recover the original value for auto-building after finishing the test.
@Override | ||
public void doTearDown() throws Exception { | ||
super.doTearDown(); | ||
setAutoBuilding(true); |
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.
You shouldn't assume true
was the original value.
Instead, save the original value in doSetUp
and apply it again in doTearDown
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.
Since there will be other tests that do not clean up properly, it is usually better to restore defaults than restoring the state before the test. So a general cleanup (also used by the platform resource tests), is to just restore the default workspace description:
ResourcesPlugin.getWorkspace().setDescription(Workspace.defaultWorkspaceDescription());
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 would make the test(s) meddle with each other but I guess since one is restoring the default value then it should be OK.
In that case, why not push this all the way to the top to UITestCase::tearDown
?
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 would make the test(s) meddle with each other
It would do the exact opposite.
In that case, why not push this all the way to the top to
UITestCase::tearDown
?
Because it is out-of-scope of this PR to refactor the complete UI test infrastructure. Having unified cleanups to ensure proper test isolation would of course make sense but should be done (1) as a separate task and (2) should be done properly using mechanisms like JUnit 4 rules or JUnit 5 extensions instead of fostering test class inheritance.
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 would make the test(s) meddle with each other
It would do the exact opposite.
It's a hack that makes this test "fix whatever other tests might have broken", that's what I meant. But it's ok, it's outside the scope of this PR to hunt down all the offending tests ;-) . BTW do you already know of any such tests (by name) or does this have to be investigated yet?
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.
BTW do you already know of any such tests (by name) or does this have to be investigated yet?
If I knew them, I would have created a ticket or fixed them. Most of the test failures I faced in the last year have one of two reasons:
- Race conditions
- Improper test isolation
What can be done systematically to ensure isolation is to encapsulate state changes or potential leaks (like job execution) into proper rules (JUnit 4) or extensions (JUnit 5).
I have now changed the Setup/Teardown to
@Override
public void doSetUp() throws Exception {
super.doSetUp();
setAutoBuilding(false);
}
@Override
public void doTearDown() throws Exception {
super.doTearDown();
ResourcesPlugin.getWorkspace().setDescription(Workspace.defaultWorkspaceDescription());
} |
…atform#275 In my experiments, the test failed in roughly 2% of runs. The test didn't close all processes which potentially accessed the files it contained. This PR Makes the Job-Manager join all jobs before finally deleting the project-root. eclipse-platform#275
681b3a8
to
d684fab
Compare
Failing checks because of new issues are only because of an outdated reference build. Recent master build reports the same new issues: https://ci.eclipse.org/platform/job/eclipse.platform.ui/job/master/421/ |
In my experiments, the test failed in roughly 2% of runs.
The test didn't close all processes and editors before deleting the files it contained.
This PR Makes the Job-Manager join all jobs before finally deleting the project-root.
This fix introduces a significant slowdown of the test (testing takes up to 2 seconds!) but since this is a single test and the test is important and the amount of fails (2%!) is big enough, I believe this tradeoff is very much justified.
I am confident in this fix working after seeing 400 consecutive runs that did not contain any fails (on windows).
#275