Skip to content

fix(ui): count the allocations of a line only in a run without the race detector - #181

Merged
ingvarch merged 1 commit into
mainfrom
fix/alloc-tests-race
Nov 4, 2026
Merged

ingvarch merged 1 commit into
mainfrom
fix/alloc-tests-race

Conversation

@ingvarch

@ingvarch ingvarch commented Nov 4, 2026

Copy link
Copy Markdown
Owner

What changes

The tests that count the allocations of a new log line failed now and then in CI: TestText_ANewLineCostsTheSameHoweverLongTheText failed on macOS in #179 with 1177 allocations against at most 1176, on a branch that changes no Go code.

CI runs the tests only with -race, and the race detector drops what sync.Pool is given at random (sync/pool.go, Put), so code that takes from a pool allocates a different number of times on each run. Locally under -race the difference between a short and a long text went from -11 to +2 over eight runs; without it both counts are 1096 every time.

  • The two tests skip under the race detector (raceOn, from a pair of files with the race build tag).
  • The check job in CI runs go test ./... without the race detector, after a lint failure too, so the counts are still checked on every push. make check already ran them that way.
  • A test on the workflow keeps that run in place.

Checklist

  • The test for this change was written first and failed
  • make check is green
  • The title is a conventional commit: feat(ui): ..., fix(nomad): ...

…ce detector

The race detector drops what sync.Pool is given at random, so the count of allocations of a line varied by about ten from run to run and failed the test now and then on macOS. The test skips under the race detector, and CI runs the tests once more without it.
@ingvarch ingvarch added this to the v0.17.0 milestone Nov 4, 2026
@ingvarch ingvarch added bug Something isn't working test Tests only labels Nov 4, 2026
@ingvarch
ingvarch merged commit c3c5b17 into main Nov 4, 2026
5 checks passed
@ingvarch
ingvarch deleted the fix/alloc-tests-race branch November 4, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working test Tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant