diff --git a/.github/actions/test-go-pg/action.yaml b/.github/actions/test-go-pg/action.yaml index 5f19da6910822..bb646a5c05ad0 100644 --- a/.github/actions/test-go-pg/action.yaml +++ b/.github/actions/test-go-pg/action.yaml @@ -71,6 +71,7 @@ runs: if [[ ${RACE_DETECTION} == true ]]; then gotestsum --junitfile="gotests.xml" --packages="${TEST_PACKAGES}" -- \ + -tags=testsmallbuffers \ -race \ -parallel "${TEST_NUM_PARALLEL_TESTS}" \ -p "${TEST_NUM_PARALLEL_PACKAGES}" diff --git a/Makefile b/Makefile index 4997430f9dd1b..8f06f3f9ca09d 100644 --- a/Makefile +++ b/Makefile @@ -1018,7 +1018,8 @@ endif # default to 8x8 parallelism to avoid overwhelming our workspaces. Hopefully we can remove these defaults # when we get our test suite's resource utilization under control. -GOTEST_FLAGS := -v -p $(or $(TEST_NUM_PARALLEL_PACKAGES),"8") -parallel=$(or $(TEST_NUM_PARALLEL_TESTS),"8") +# Use testsmallbuffers tag to reduce wireguard memory allocation in tests (from ~18GB to negligible). +GOTEST_FLAGS := -tags=testsmallbuffers -v -p $(or $(TEST_NUM_PARALLEL_PACKAGES),"8") -parallel=$(or $(TEST_NUM_PARALLEL_TESTS),"8") # The most common use is to set TEST_COUNT=1 to avoid Go's test cache. ifdef TEST_COUNT @@ -1081,6 +1082,7 @@ test-postgres: test-postgres-docker --jsonfile="gotests.json" \ $(GOTESTSUM_RETRY_FLAGS) \ --packages="./..." -- \ + -tags=testsmallbuffers \ -timeout=20m \ -count=1 .PHONY: test-postgres @@ -1153,7 +1155,7 @@ test-postgres-docker: # Make sure to keep this in sync with test-go-race from .github/workflows/ci.yaml. test-race: - $(GIT_FLAGS) gotestsum --junitfile="gotests.xml" -- -race -count=1 -parallel 4 -p 4 ./... + $(GIT_FLAGS) gotestsum --junitfile="gotests.xml" -- -tags=testsmallbuffers -race -count=1 -parallel 4 -p 4 ./... .PHONY: test-race test-tailnet-integration: @@ -1163,6 +1165,7 @@ test-tailnet-integration: TS_DEBUG_NETCHECK=true \ GOTRACEBACK=single \ go test \ + -tags=testsmallbuffers \ -exec "sudo -E" \ -timeout=5m \ -count=1 \ diff --git a/go.mod b/go.mod index acc8abdba4fd8..5008b0a848528 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,8 @@ replace tailscale.com => github.com/coder/tailscale v1.1.1-0.20250829055706-6eaf // This is replaced to include // 1. a fix for a data race: c.f. https://github.com/tailscale/wireguard-go/pull/25 // 2. update to the latest gVisor -replace github.com/tailscale/wireguard-go => github.com/coder/wireguard-go v0.0.0-20240522052547-769cdd7f7818 +// 3. testsmallbuffers build tag for reduced memory usage in tests +replace github.com/tailscale/wireguard-go => github.com/coder/wireguard-go v0.0.0-20251212134302-bb12dfe22d7f // Switch to our fork that imports fixes from http://github.com/tailscale/ssh. // See: https://github.com/coder/coder/issues/3371 diff --git a/go.sum b/go.sum index 9d226f7252c62..6630804b2ae6b 100644 --- a/go.sum +++ b/go.sum @@ -964,8 +964,8 @@ github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9F github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= github.com/coder/wgtunnel v0.1.13-0.20240522110300-ade90dfb2da0 h1:C2/eCr+r0a5Auuw3YOiSyLNHkdMtyCZHPFBx7syN4rk= github.com/coder/wgtunnel v0.1.13-0.20240522110300-ade90dfb2da0/go.mod h1:qANbdpqyAGlo2bg+4gQKPj24H1ZWa3bQU2Q5/bV5B3Y= -github.com/coder/wireguard-go v0.0.0-20240522052547-769cdd7f7818 h1:bNhUTaKl3q0bFn78bBRq7iIwo72kNTvUD9Ll5TTzDDk= -github.com/coder/wireguard-go v0.0.0-20240522052547-769cdd7f7818/go.mod h1:fAlLM6hUgnf4Sagxn2Uy5Us0PBgOYWz+63HwHUVGEbw= +github.com/coder/wireguard-go v0.0.0-20251212134302-bb12dfe22d7f h1:EV5L4DiIuaoQNsM/9Ftm3C7mE2rr+PDf9ncGo+MqgeM= +github.com/coder/wireguard-go v0.0.0-20251212134302-bb12dfe22d7f/go.mod h1:fAlLM6hUgnf4Sagxn2Uy5Us0PBgOYWz+63HwHUVGEbw= github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4= github.com/containerd/continuity v0.4.5/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI=