Skip to content

Make accumulator test on DoNotMirror field deterministic #963

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

fgiudici
Copy link
Member

Pull Request Checklist

  • [x ] Changes to scripting or CI config have been tested to the best of your ability

Types of Change

Fix sporadic unit test failure, as in https://github.com/rancher/image-mirror/actions/runs/15631022751/job/44035182148?pr=962

Linked Issues

Additional Notes

Since accumulator.Images() returns a slice of Image(s) picking them from a map, the order of the resulting images is not deterministic (maps element order is unreliable).

This may cause sporadic failures of the unit test.

Do the assertions depending on the actual order of the returned images.

Since accumulator.Images() returns a slice of Image(s) picking them from
a map, the order of the resulting images is not deterministic (maps
element order is unreliable).

This may cause sporadic failures of the unit test.

Signed-off-by: Francesco Giudici <[email protected]>
@fgiudici fgiudici requested a review from a team as a code owner June 13, 2025 12:27
@fgiudici fgiudici changed the title Make test deterministic Make accumulator test on DoNotMirror field deterministic Jun 13, 2025
Copy link
Contributor

@adamkpickering adamkpickering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this as well, but planned to fix it as part of rancher/rancher#50476. In the meantime this is great!

@brandond
Copy link
Member

Is there an expectation that the accumulator returns images in any particular order? alphabetical or otherwise?

@fgiudici
Copy link
Member Author

Hey thanks for the review!
I cannot merge as I'm missing merge superpowers on this branch 🦸🏼 😄

@adamkpickering
Copy link
Contributor

@brandond the accumulator doesn't do any sorting. Sorting is done before writing to each file, if necessary.

@adamkpickering adamkpickering merged commit 82111b7 into rancher:master Jun 16, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants