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

Fixed Non-deterministic behavior of HashMap that might fail tests using ContentFragment.getExportedElements() #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SaaiVenkat
Copy link
Owner

@SaaiVenkat SaaiVenkat commented Oct 18, 2023

Q A
Fixed Issues? Fixes #2608
Patch: Bug Fix? Yes
Minor: New Feature? No
Major: Breaking Change? No
Tests Added + Pass? Tests Pass
Documentation Provided No (Added Code Comments)
Any Dependency Changes? No
License Apache License, Version 2.0
  • Since the change in ordering of elements loaded by resource.getChild() when mocking the ContentFragment causes the issue, sorting the elements loaded by the resource will solve the issue.
  • Sorting the elements based on the property name ensures that the elements are always returned in a deterministic order.
  • I have used streams().sorted() to sort the key set, and I have collected the values in List to make sure the order remains constant across different runs.

@RugvedB
Copy link

RugvedB commented Oct 20, 2023

Ok, Noted. Feel free to let me know after you update the PR description. Thank you!

@njain2208
Copy link

Let us know when you have updated the title, branch, and description. The changes you have made look good to me.

@SaaiVenkat SaaiVenkat changed the title Fixed flaky test [Content Fragment] Non-deterministic behavior of HashMap might fail tests using ContentFragment.getExportedElements() Nov 1, 2023
@SaaiVenkat
Copy link
Owner Author

@RugvedB @njain2208 I have updated the PR for your review. The necessary details are linked in the Fixed issues section.

@SaaiVenkat SaaiVenkat changed the title [Content Fragment] Non-deterministic behavior of HashMap might fail tests using ContentFragment.getExportedElements() Fixed Non-deterministic behavior of HashMap that might fail tests using ContentFragment.getExportedElements() Nov 3, 2023
@RugvedB
Copy link

RugvedB commented Nov 3, 2023

I went through your code and it looks good to me. I just feel that the explanation is too lengthy but if thats not an issue, then its all good. Good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants