Skip to content

Commit cdfa4cb

Browse files
authored
Reduce flakiness of wasm tests (#576)
1 parent 62ee04a commit cdfa4cb

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

.github/workflows/build-test.yaml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ jobs:
4545

4646
development:
4747
name: "WASM Tests"
48-
# TODO: figure out workaround for apparmor issue
49-
# see #449
50-
runs-on: "ubuntu-22.04"
48+
runs-on: "depot-ubuntu-24.04-4"
5149
steps:
5250
- uses: "actions/checkout@v5"
5351
- uses: "authzed/actions/setup-go@main"
@@ -56,8 +54,33 @@ jobs:
5654
# go env gopath won't point at the right install location for the
5755
# wasm tool.
5856
go-version: "1.23.2"
59-
cache: "false" # do not cache to prevent cache poisoning
57+
- name: "Disable AppArmor"
58+
if:
59+
"runner.os == 'Linux'"
60+
# Disable AppArmor for Ubuntu 23.10+.
61+
# https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
62+
run: "echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"
6063
- name: "Install wasmbrowsertest"
6164
run: "go install github.com/agnivade/wasmbrowsertest@latest"
65+
# cleanenv is a util provided by the wasmbrowsertest package that removes
66+
# environment variables from the environment handed to wasmbrowsertest.
67+
# this works around https://github.com/agnivade/wasmbrowsertest/issues/40,
68+
# which we were experiencing on depot.
69+
- name: "Install cleanenv"
70+
run: "go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@latest"
6271
- name: "Run WASM Tests"
63-
run: "GOOS=js GOARCH=wasm go test ./pkg/wasm/... -exec $(go env GOPATH)/bin/wasmbrowsertest"
72+
# There's a whole bunch of vars in the environment that aren't needed for running this test, so we clear them out.
73+
# NOTE: if you need to do this in the future, I recommend bashing into the container and running `env | sort | less`
74+
run: |-
75+
GOOS=js \
76+
GOARCH=wasm \
77+
cleanenv \
78+
-remove-prefix GITHUB_ \
79+
-remove-prefix ANDROID_ \
80+
-remove-prefix JAVA_ \
81+
-remove-prefix DOTNET_ \
82+
-remove-prefix RUNNER_ \
83+
-remove-prefix HOMEBREW_ \
84+
-remove-prefix runner_ \
85+
-- \
86+
go test ./pkg/wasm/... -exec $(go env GOPATH)/bin/wasmbrowsertest

0 commit comments

Comments
 (0)