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

@@ -49,11 +49,11 @@ help:
# Development commands
test:
@echo "Running tests..."
CGO_ENABLED=1 $(GO) test -v ./...
CGO_ENABLED=1 $(GO) test -v -race ./...
test-coverage:
@echo "Running tests with coverage..."
CGO_ENABLED=1 $(GO) test -v -coverprofile=coverage.out ./...
CGO_ENABLED=1 $(GO) test -v -race -coverprofile=coverage.out ./...
$(GO) tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"