Skip to content

test(lock): fix SetMax test range - #36

Open
SSOHEB wants to merge 1 commit into
flatcar:flatcar-masterfrom
SSOHEB:fix/semaphore-test-range-values
Open

test(lock): fix SetMax test range#36
SSOHEB wants to merge 1 commit into
flatcar:flatcar-masterfrom
SSOHEB:fix/semaphore-test-range-values

Conversation

@SSOHEB

@SSOHEB SSOHEB commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the TestSetMax test in lock/semaphore_test.go.

The test defines an explicit sequence of values:

3, 2, 1, 0, -1, 0, 1, 2, 3

but uses a single variable range, which iterates over the slice indices rather than its values. As a result, the test actually passes 0, 1, 2, 3, 4, 5, 6, 7, 8 to SetMax() and never exercises the intended negative or decreasing values.

This changes the loop to use for _, i := range ..., so the test actually exercises the values it defines.

Testing

  • go test ./lock
  • git diff --check

All tests pass.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

Signed-off-by: SSOHEB <shaykhsuhaib7@gmail.com>
@SSOHEB
SSOHEB requested a review from a team as a code owner August 13, 2026 12:36
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.

1 participant