-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(policy): ignore route .status.parents ordering (#13328)
The `eq_time_insensitive_route_parent_statuses` considers ordering when comparing statuses, even though ordering doesn't matter. This can result in infite update loops. Add logic to `eq_time_insensitive_route_parent_statuses` to pre-sort statuses before comparison, thus making the result independent of ordering. A unit test was added to validate the fix. Fixes #13327 Signed-off-by: Derek Brown <6845676+DerekTBrown@users.noreply.github.com>
- Loading branch information
1 parent
8265134
commit f8a1343
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use super::make_parent_status; | ||
use crate::index::eq_time_insensitive_route_parent_statuses; | ||
|
||
#[test] | ||
fn test_eq_time_insensitive_route_parent_statuses_order_sensitive() { | ||
// Create RouteParentStatus instances using make_parent_status helper | ||
let status1 = make_parent_status("ns", "parent1", "Ready", "True", "AllGood"); | ||
let status2 = make_parent_status("ns", "parent2", "Ready", "True", "AllGood"); | ||
|
||
// Create two lists with the same elements in different orders | ||
let list1 = vec![status1.clone(), status2.clone()]; | ||
let list2 = vec![status2, status1]; | ||
|
||
// Assert that eq_time_insensitive_route_parent_statuses returns true | ||
// indicating that it considers the two lists equal | ||
assert!(eq_time_insensitive_route_parent_statuses(&list1, &list2)); | ||
} |