Skip to content

Conversation

@brandur
Copy link
Contributor

@brandur brandur commented Mar 8, 2025

Here, fix an intermittent test [1] that's come up already since #795
was merged in. This is a problem that gets me a lot, which is that map
sorting in Go is not guaranteed, despite in tests small maps often
coming out in the order that you're looking for so you don't notice a
problem until later.

Here, when processing named args in a template, walk through them in
alphabetical order. This has no meaningful effect on the rendered SQL,
but provides stability for the test suite.

[1] https://github.com/riverqueue/river/actions/runs/13734150171/job/38415749775?pr=795

…ting

Here, fix an intermittent test [1] that's come up _already_ since #795
was merged in. This is a problem that gets me a lot, which is that map
sorting in Go is not guaranteed, despite in tests small maps often
coming out in the order that you're looking for so you don't notice a
problem until later.

Here, when processing named args in a template, walk through them in
alphabetical order. This has no meaningful effect on the rendered SQL,
but provides stability for the test suite.

[1] https://github.com/riverqueue/river/actions/runs/13734150171/job/38415749775?pr=795
@brandur brandur requested a review from bgentry March 8, 2025 05:12
Copy link
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

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

Fun fact. In an interview years ago I couldn't recall how to randomly shuffle a slice and wasn't supposed to look things up, so I made it work by relying on a map for a weak pseudo-random sort 😆

@brandur
Copy link
Contributor Author

brandur commented Mar 9, 2025

Fun fact. In an interview years ago I couldn't recall how to randomly shuffle a slice and wasn't supposed to look things up, so I made it work by relying on a map for a weak pseudo-random sort 😆

LOL!!! A+ Go deep cut rating.

@brandur brandur merged commit a7f8c4b into master Mar 9, 2025
19 of 20 checks passed
@brandur brandur deleted the brandur-fix-intermittent-tests branch March 9, 2025 00:51
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