Closed KiruthikaJanakiraman closed 11 months ago
Welcome @KiruthikaJanakiraman! 👋 Thanks for taking the time to contribute!
./gradlew goJF
and commit the updated files?Welcome @KiruthikaJanakiraman! 👋 Thanks for taking the time to contribute!
- When you have a chance, could you submit the Apereo ICLA? https://www.apereo.org/licensing/agreements/icla
- The tests are currently failing due to formatting, could you run
./gradlew goJF
and commit the updated files?- To confirm your goal, your goal is to reduce flakiness in CI/CD? (Very much appreciated) Or is there also a bug you are trying to reproduce?
Hi Christian,
./gradlew goJF
) and committed the formatted files.
Checklist
Description of change
This PR aims to fix the following 5 flaky test:
I found and confirmed the flaky behavior of the tests using an open-source research tool NonDex, which shuffles implementations of nondeterminism operations.
Problem The test case org.apereo.portal.events.tincan.json.LrsDataModelSerializeTest.testLrsActorSerialize fails due to the below assertion as the order of the fields within the object
lrsActor
changes upon nondeterministic shuffling causing the order of JSON stringresult
to change.https://github.com/uPortal-Project/uPortal/blob/59f8895fe98782e1ff23dd14f9eb2076db09b04e/uPortal-webapp/src/test/java/org/apereo/portal/events/tincan/json/LrsDataModelSerializeTest.java#L52-L57
Solution This PR fixes the flakiness by using an ObjectMapper class to convert the JSON strings to JsonNode and then comparing the JsonNodes using JsonNode.equals method which performs a full(deep) comparison.
The other 4 test are also fixed similarly using this method.
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.