diff --git a/.github/workflows/robustness_template.yaml b/.github/workflows/robustness_template.yaml index 9e8e3ec26..18d7bbb39 100644 --- a/.github/workflows/robustness_template.yaml +++ b/.github/workflows/robustness_template.yaml @@ -34,4 +34,4 @@ jobs: set -euo pipefail sudo apt-get install -y dmsetup xfsprogs - ROBUSTNESS_TESTFLAGS="--count ${{ inputs.count }} --timeout ${{ inputs.testTimeout }} -failfast" make test-robustness + SUDO=true ROBUSTNESS_TESTFLAGS="--count ${{ inputs.count }} --timeout ${{ inputs.testTimeout }} -failfast" make test-robustness diff --git a/Makefile b/Makefile index f5a6703a0..6c2f3094f 100644 --- a/Makefile +++ b/Makefile @@ -90,11 +90,16 @@ test-failpoint: @echo "[failpoint] array freelist test" BBOLT_VERIFY=all TEST_FREELIST_TYPE=array go test -v ${TESTFLAGS} -timeout 30m ./tests/failpoint -.PHONY: test-robustness # Running robustness tests requires root permission for now -# TODO: Remove sudo once we fully migrate to the prow infrastructure -test-robustness: gofail-enable build - sudo env PATH=$$PATH go test -v ${TESTFLAGS} ./tests/dmflakey -test.root - sudo env PATH=$(PWD)/bin:$$PATH go test -v ${TESTFLAGS} ${ROBUSTNESS_TESTFLAGS} ./tests/robustness -test.root +ifeq ($(SUDO),) +exec_sudo = +else +exec_sudo = sudo +endif + +.PHONY: test-robustness # Running robustness tests requires to run as superuser +test-robustness:# gofail-enable build + $(exec_sudo) env PATH=$$PATH go test -v ${TESTFLAGS} ./tests/dmflakey -test.root + $(exec_sudo) env PATH=$(PWD)/bin:$$PATH go test -v ${TESTFLAGS} ${ROBUSTNESS_TESTFLAGS} ./tests/robustness -test.root .PHONY: test-benchmark-compare # Runs benchmark tests on the current git ref and the given REF, and compares