[fix][test] Fixed Non-Guaranteed Order in PoliciesDataTest.propertyAdmin#24871
Merged
lhotari merged 1 commit intoapache:masterfrom Nov 12, 2025
Merged
Conversation
Contributor
|
/pulsarbot rerun-failure-checks |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #24871 +/- ##
============================================
- Coverage 74.34% 74.21% -0.14%
- Complexity 33496 34011 +515
============================================
Files 1913 1920 +7
Lines 149315 150232 +917
Branches 17331 17427 +96
============================================
+ Hits 111012 111496 +484
- Misses 29475 29838 +363
- Partials 8828 8898 +70
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
lhotari
requested changes
Nov 11, 2025
pulsar-common/src/test/java/org/apache/pulsar/common/policies/data/PoliciesDataTest.java
Outdated
Show resolved
Hide resolved
f9d7783 to
7070d90
Compare
lhotari
approved these changes
Nov 11, 2025
7070d90 to
6d6d995
Compare
ganesh-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Nov 24, 2025
…min (apache#24871) (cherry picked from commit 2bf095d) (cherry picked from commit c46883b)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Nov 25, 2025
…min (apache#24871) (cherry picked from commit 2bf095d) (cherry picked from commit c46883b)
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.
Fixes #24870
Motivation
The below test performed an assertion that incorrectly assumed the order of the HashSet data that was utilized in the formation of one of the arrays. No guarantees are made to the iteration order of the set or that this order will remain constant over time. As a result, the ordering can change due to different environments producing the contents in different orders despite the logical contents being the same.
org.apache.pulsar.common.policies.data.PoliciesDataTest.propertyAdminIn essence, these changes keep the spirit of the original tests while eliminating failures caused solely by the previously unexpected reordering the HashSet can induce onto the final array contents.
Modifications
The original test converted the HashSet data directly into an ArrayList, incorrectly assuming a consistent iteration order. We now sort the ArrayList prior to asserting to ensure deterministic ordering.
In essence, these changes keep the spirit of the original tests while eliminating failures caused solely by allowed (but previously unexpected) reordering.
Verifying this change
This change is already covered by existing tests, such as
org.apache.pulsar.common.policies.data.PoliciesDataTest.propertyAdminDoes this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: LucasEby#5