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 deadlock and other failures #3751

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented Nov 25, 2022

Identify the Bug or Feature request

Fixes (hopefully) #3750

Description of the Change

The CampaignPropertiesDialogTest is now run on the Swing thread in order to avoid deadlocks that would sometimes occur when running on the main test thread.

The GetInfoFunctionTest is now repeatable and not dependent on the order of the tests. The problem was that one test was injecting a dummy SysInfoProvider that could be consumed by the other test. This is fixed by always restoring the SysInfoProvider implementation after each test.

The MemoryDataStoreTest was sensitive to the ordering of its various asynchronous calls. Meanwhile, MemoryDataStore does not guarantee the ordering of effects as it runs everything on the common fork-join pool. Sprinkling in some more .get() fixes that.

Prior to this change, I could only complete a few test suite runs before encountering a deadlock or other failure. With this change, I have been consistently able to complete thousands of test suite runs, each completing promptly.

Possible Drawbacks

Should be sunshine and rainbows.

Documentation Notes

N/A

Release Notes

N/A


This change is Reviewable

Building the dialog off the Swing thread gives the potential for deadlocks when we try to pack the dialog.
One of the tests was injecting a dummy implementation, but didn't clean up after itself. This made the order of the
tests important. But now we always restore a real implementation after the tests are done, so that tests can now be run
in any order and even multiple times.
Since adding and reading namespaces are both asynchronous processes, and sequential calls are not guaranteed to
serialize with one another, we had to add `.get()` calls inside `MemoryDataStoreTest.createNamespaceWithInitialData()`
so that we could be sure each namespace was created before being accessed.
Copy link
Contributor

@Phergus Phergus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @kwvanderlinde)

@Phergus Phergus merged commit 04089ca into RPTools:develop Nov 25, 2022
@kwvanderlinde kwvanderlinde deleted the fixup/3750-hanging-tests-and-other-failures branch November 25, 2022 17:28
@cwisniew cwisniew added the bug label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants