fix: add mutex to mockLogger in errorbus tests to prevent race conditions
Some checks failed
CI / Test (pull_request) Successful in 22s
CI / Lint (pull_request) Failing after 17s
CI / Build (pull_request) Successful in 12s
CI / Format Check (pull_request) Successful in 2s

The mockLogger's errors slice was being accessed concurrently from
multiple goroutines (the error bus consumer and the test goroutine),
causing race conditions when running tests with the race detector.

Added sync.Mutex to protect the errors slice and proper locking when
accessing it in test assertions.
This commit is contained in:
2025-11-05 21:11:14 +01:00
parent 3f3545ba15
commit 7ffacb6620
3 changed files with 22 additions and 7 deletions

View File

@@ -150,8 +150,10 @@ When working on this project, follow this workflow:
- Use descriptive branch names (e.g., `feature/epic1-http-server`, `bugfix/auth-token-expiry`, `enhancement/rate-limiting`)
- Branch names should follow the pattern: `{type}/{epic}-{short-description}` or `{type}/{story-id}-{short-description}`
- **ALWAYS create a commit** after successfully implementing a feature that:
- ✅ Builds successfully (`go build` passes)
- ✅ Tests pass (`go test` passes)
- ✅ Builds successfully (`make build` passes)
- ✅ Tests pass (`make test` passes)
- ✅ Lint pass (`make lint` passes)
- ✅ fmt-check pass (`make fmt-check` passes)
- ✅ Meets all acceptance criteria from the story
- Commit messages should be clear and descriptive, referencing the story/epic when applicable
- Never commit directly to `main` branch