From ae4066562fc2af0c3981ce37efc2d75be9c4e550 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 4 Apr 2026 12:37:55 +0000 Subject: [PATCH 1/2] build: add test-race Makefile target for race condition detection The MCP Gateway is a highly concurrent server handling multiple simultaneous MCP connections. Running tests with the Go race detector surfaces data races that regular unit tests may miss. Add a test-race target that: - Runs all unit tests under Go's -race detector - Uses a 5-minute timeout to accommodate the overhead of race detection - Is fast to run locally without requiring a build step Usage: make test-race Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 13361b57..972caf53 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build lint test test-unit test-integration test-container-proxy test-all test-serena test-serena-gateway coverage test-ci format clean install release help agent-finished +.PHONY: build lint test test-unit test-race test-integration test-container-proxy test-all test-serena test-serena-gateway coverage test-ci format clean install release help agent-finished # Default target .DEFAULT_GOAL := help @@ -60,6 +60,13 @@ test-integration: fi @go test -v ./test/integration/... +# Run unit tests with race detection (catches concurrent data races) +# The MCP Gateway is a concurrent server; use this to validate thread safety. +test-race: + @echo "Running unit tests with race detection..." + @go test -race -timeout=5m ./internal/... + @echo "Race detection tests complete!" + # Run container proxy integration tests (requires Docker and gh CLI) test-container-proxy: @echo "Running container proxy integration tests..." @@ -305,6 +312,7 @@ help: @echo " lint - Run all linters (go vet, gofmt check, golangci-lint)" @echo " test - Run unit tests (no build required)" @echo " test-unit - Run unit tests (no build required)" + @echo " test-race - Run unit tests with race detection (catches concurrent data races)" @echo " test-integration - Run binary integration tests (requires built binary)" @echo " test-all - Run all tests (unit + integration)" @echo " test-serena - Run Serena MCP Server tests (direct connection)" From a51229a6bba6988999690d8bd4787b95c8366119 Mon Sep 17 00:00:00 2001 From: Landon Cox Date: Sat, 4 Apr 2026 11:25:25 -0700 Subject: [PATCH 2/2] Update Makefile Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 972caf53..49a6f824 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,7 @@ test-integration: # The MCP Gateway is a concurrent server; use this to validate thread safety. test-race: @echo "Running unit tests with race detection..." + @go mod tidy @go test -race -timeout=5m ./internal/... @echo "Race detection tests complete!"