From 60fc24cd6c0a65b9a75cef04b33201a73625e65f Mon Sep 17 00:00:00 2001 From: igolaizola <11333576+igolaizola@users.noreply.github.com> Date: Wed, 29 Jan 2025 08:47:37 +0100 Subject: [PATCH] Add `WASM_NO_SANDBOX=on` to disable Chrome sandbox The CI is currently failing with the following error message: "No usable sandbox! If you are running on Ubuntu 23.10+ or another Linux distro that has disabled unprivileged user namespaces..." This commit updates the wasmbrowsertest to a version that supports the WASM_NO_SANDBOX environment variable, which disables the Chrome sandbox. Then it adds the environment variable to `TestWasm` in `conn_test.go`. --- ci/test.sh | 2 +- conn_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/test.sh b/ci/test.sh index a3007614..18bb8fdf 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -24,7 +24,7 @@ cd -- "$(dirname "$0")/.." ) -go install github.com/agnivade/wasmbrowsertest@latest +go install github.com/igolaizola/wasmbrowsertest@no-sandbox-env-test go test --race --bench=. --timeout=1h --covermode=atomic --coverprofile=ci/out/coverage.prof --coverpkg=./... "$@" ./... sed -i.bak '/stringer\.go/d' ci/out/coverage.prof sed -i.bak '/nhooyr.io\/websocket\/internal\/test/d' ci/out/coverage.prof diff --git a/conn_test.go b/conn_test.go index 9ed8c7ea..d573f5a2 100644 --- a/conn_test.go +++ b/conn_test.go @@ -365,7 +365,7 @@ func TestWasm(t *testing.T) { defer cancel() cmd := exec.CommandContext(ctx, "go", "test", "-exec=wasmbrowsertest", ".", "-v") - cmd.Env = append(cleanEnv(os.Environ()), "GOOS=js", "GOARCH=wasm", fmt.Sprintf("WS_ECHO_SERVER_URL=%v", s.URL)) + cmd.Env = append(cleanEnv(os.Environ()), "GOOS=js", "GOARCH=wasm", fmt.Sprintf("WS_ECHO_SERVER_URL=%v", s.URL), "WASM_NO_SANDBOX=on") b, err := cmd.CombinedOutput() if err != nil {