Fix flaky test: testStylesheetDescriptor40ImportExport#2732
Merged
ChristianMurphy merged 2 commits intoNov 18, 2023
Conversation
ChristianMurphy
approved these changes
Nov 18, 2023
ChristianMurphy
left a comment
Member
There was a problem hiding this comment.
Thanks @KiruthikaJanakiraman! LGTM
A finer point here.
I'm not sure this is precisely a "flaky test".
Flaky implies the test fails.
uPortal is tested across multiple major versions of the JDK, multiple JDK implementations, on multiple operating systems, for tens of thousands of test runs. I haven't seen it fail.
It could be fair to say the test is under specified or under determined, and that in a hypothetical future it could fail, but it is not strictly flaky. 🙂
Pedantics aside, I appreciate the PRs! Keep them coming! 😁
Contributor
Author
|
Got it. In that case, "under determined" makes more sense. Thanks! |
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.
Checklist
Description of change
This PR aims to fix the flaky test: org.apereo.portal.io.xml.IdentityImportExportTest.testStylesheetDescriptor40ImportExport similar to previously raised PRs: #2718 and #2719
I found and confirmed the flaky behaviour of the tests using an open-source research tool NonDex, which shuffles implementations of nondeterminism operations.
Problem
The test case org.apereo.portal.io.xml.IdentityImportExportTest.testStylesheetDescriptor40ImportExport fails because the order of
targetElements:channelandportletin the exported xml varies upon nondeterministic shuffling.uPortal/uPortal-webapp/src/test/resources/org/apereo/portal/io/xml/ssd/test_4-0.stylesheet-descriptor.xml
Lines 49 to 50 in 7fe3d5d
Solution
This PR fixes the flakiness by sorting the
targetElementsin exportData before comparing importData and exportData XMLs.Steps to reproduce
The following command can be used to reproduce the assertion errors and verify the fix.
Integrate NonDex:
Add the following snippet to the top of the build.gradle in $PROJ_DIR:
Append to build.gradle in $PROJ_DIR:
Execute Test with Gradle:
Run NonDex:
Test Environment:
Please let me know if you have any concerns or questions.