fix: add mutex to mockLogger in errorbus tests to prevent race conditions
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:
4
Makefile
4
Makefile
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user