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

slices: don't modify input slices in test #30677

Merged
merged 1 commit into from Feb 17, 2024

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Feb 8, 2024

In Go 1.22, slices.CompactFunc will clear the slice elements that got discarded. This makes TestSortedUniqueFunc fail if it is run in succession to other tests modifying the input slice.

Avoid this case by not modifying the input slice in the test case but make a copy for the sake of the test.

@tklauser tklauser added the release-note/misc This PR makes changes that have no direct user impact. label Feb 8, 2024
@tklauser tklauser requested review from a team as code owners February 8, 2024 09:57
@tklauser
Copy link
Member Author

tklauser commented Feb 8, 2024

/test

@tklauser tklauser force-pushed the pr/tklauser/slices-tests-go1.22 branch from 01b0ffd to a894cf2 Compare February 8, 2024 10:14
@tklauser tklauser removed request for a team and danehans February 8, 2024 10:14
@tklauser
Copy link
Member Author

tklauser commented Feb 8, 2024

/test

In Go 1.22, slices.CompactFunc will clear the slice elements that got
discarded. This makes TestSortedUniqueFunc fail if it is run in
succession to other tests modifying the input slice.

Avoid this case by not modifying the input slice in the test case but
make a copy for the sake of the test.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@aanm aanm force-pushed the pr/tklauser/slices-tests-go1.22 branch from a894cf2 to 01dcc21 Compare February 17, 2024 12:00
@aanm
Copy link
Member

aanm commented Feb 17, 2024

/test

@tklauser tklauser added this pull request to the merge queue Feb 17, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Feb 17, 2024
Merged via the queue into main with commit 32543a4 Feb 17, 2024
220 checks passed
@tklauser tklauser deleted the pr/tklauser/slices-tests-go1.22 branch February 17, 2024 14:38
@tklauser tklauser added needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch labels Feb 20, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.15.2 Feb 20, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.14.8 Feb 20, 2024
@YutaroHayakawa YutaroHayakawa mentioned this pull request Feb 27, 2024
9 tasks
@YutaroHayakawa YutaroHayakawa added backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. and removed needs-backport/1.15 This PR / issue needs backporting to the v1.15 branch labels Feb 27, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.15 in 1.15.2 Feb 27, 2024
@YutaroHayakawa YutaroHayakawa mentioned this pull request Feb 27, 2024
5 tasks
@YutaroHayakawa YutaroHayakawa added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Feb 27, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from main to Backport pending to v1.14 in 1.14.8 Feb 27, 2024
@github-actions github-actions bot added backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. and removed backport-pending/1.15 The backport for Cilium 1.15.x for this PR is in progress. labels Feb 28, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.15 to Backport done to v1.15 in 1.15.2 Feb 28, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed this from Backport done to v1.15 in 1.15.2 Feb 28, 2024
@github-actions github-actions bot added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Mar 1, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Backport done to v1.15 in 1.15.2 Mar 1, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.14 to Backport done to v1.14 in 1.14.8 Mar 1, 2024
@maintainer-s-little-helper maintainer-s-little-helper bot removed this from Backport pending to v1.14 in 1.14.8 Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. backport-done/1.15 The backport for Cilium 1.15.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.15.2
Backport done to v1.15
Development

Successfully merging this pull request may close these issues.

None yet

4 participants