Skip to content
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 test for save state cleanup on snapshot save / bug 297635 #460 #737

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

HeikoKlare
Copy link
Contributor

The existing test TestBug297635 relies on reflection to test some internal state change of the SavedState class that saves temporary states until some save operation. The test was prone to fail because it relied on internal state changes that depend an specific overall system state (e.g., have an unsaved workspace state, so that no concurrent automatic snapshot save is allowed to occur during test execution). It used reflection to access an internal, highly volatile state.

The bug for which the test case serves as a regression test was due to missing cleanup triggered by SavedState.forgetSavedTree(). Instead of checking for internal state changes performed by the cleanup, the rewritten test only checks for a call of the according method. To this end, it temporarily inserts a spy on the SaveManager. Since a Workspace and SaveManager are not easy to set up in an isolated way for testing purposes, the test still relies on reflection, but only to inject a spy on the SaveManager rather than to validate internal states.

Since the test is not required to be run as a session test anymore, it is moved to the ordinary regression resource tests.

Fixes #460.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2023

Test Results

     36 files   -        6       36 suites   - 6   48m 57s ⏱️ - 6m 4s
2 743 tests  - 1 035  2 740 ✔️  - 1 035    3 💤 ±0  0 ±0 
8 232 runs   - 3 105  8 205 ✔️  - 3 105  27 💤 ±0  0 ±0 

Results for commit 7afdb42. ± Comparison against base commit 0b0eff5.

This pull request removes 1036 and adds 1 tests. Note that renamed tests count towards both.
org.eclipse.core.tests.resources.session.TestBug297635 ‑ testBug
org.eclipse.ua.tests.cheatsheet.composite.TestCheatSheetManagerEvents ‑ testNoHandler
org.eclipse.ua.tests.cheatsheet.composite.TestCheatSheetManagerEvents ‑ testOneHandler
org.eclipse.ua.tests.cheatsheet.composite.TestCheatSheetManagerEvents ‑ testTwoHandlers
org.eclipse.ua.tests.cheatsheet.composite.TestCompositeParser ‑ testBackwardDependency
org.eclipse.ua.tests.cheatsheet.composite.TestCompositeParser ‑ testBadURL
org.eclipse.ua.tests.cheatsheet.composite.TestCompositeParser ‑ testChoiceNoChild
org.eclipse.ua.tests.cheatsheet.composite.TestCompositeParser ‑ testCircularDependency
org.eclipse.ua.tests.cheatsheet.composite.TestCompositeParser ‑ testCompositeNoName
org.eclipse.ua.tests.cheatsheet.composite.TestCompositeParser ‑ testDependency
…
org.eclipse.core.tests.resources.regression.Bug_297635 ‑ testCleanSaveStateBySaveParticipantOnSnapshotSave

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare marked this pull request as ready for review October 9, 2023 17:27
@HeikoKlare HeikoKlare requested a review from fedejeanne October 12, 2023 08:36
@HeikoKlare HeikoKlare force-pushed the issue-460 branch 2 times, most recently from 69978f2 to f9a5b76 Compare October 13, 2023 10:17
@HeikoKlare HeikoKlare force-pushed the issue-460 branch 2 times, most recently from 19dbe22 to cd75c85 Compare October 13, 2023 11:26
@fedejeanne
Copy link
Contributor

Looks good :-)

…-platform#460

The existing test TestBug297635 relies on reflection to test some
internal state change of the SavedState class that saves temporary
states until some save operation. The test was prone to fail because it
relied on internal state changes that depend an specific overall system
state (e.g., have an unsaved workspace state, so that no concurrent
automatic snapshot save is allowed to occur during test execution). It
used reflection to access an internal, highly volatile state.

The bug for which the test case serves as a regression test was due to
missing cleanup triggered by SavedState.forgetSavedTree(). Instead of
checking for internal state changes performed by the cleanup, the
rewritten test only checks for a call of the according method. To this
end, it temporarily inserts a spy on the SaveManager. Since a Workspace
and SaveManager are not easy to set up in an isolated way for testing
purposes, the test still relies on reflection, but only to inject a spy
on the SaveManager rather than to validate internal states.

Since the test is not required to be run as a session test anymore, it
is moved to the ordinary regression resource tests.

Fixes eclipse-platform#460.
@HeikoKlare
Copy link
Contributor Author

Failing test is unrelated and documented in #744.

In addition, checks are only failing because of an API tooling issue, see eclipse-pde/eclipse.pde#782.
PR only changes one file and version bump for containing plug-in has already been made for 4.30 stream.

@HeikoKlare HeikoKlare merged commit cfb3c5f into eclipse-platform:master Oct 13, 2023
6 of 11 checks passed
@HeikoKlare HeikoKlare deleted the issue-460 branch October 13, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random failing of TestBug297635
3 participants