From 82b777d59f611c51011279235bbf5bcbae907a21 Mon Sep 17 00:00:00 2001 From: Claudia Beresford Date: Wed, 10 Nov 2021 13:14:08 +0000 Subject: [PATCH] Do not run tests with sudo So we setup our action with go 1.17. However the ubuntu machine sets up an earlier version of go by default (1.15) When we add 1.17 it is added for the non-root user only. Our action was running `sudo ... make test` so it is running with 1.15 and caused annoying failures. --- .github/workflows/test.yml | 4 +++- Makefile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4c2d09d4b..699f9e566 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,9 @@ jobs: - name: Build e2e run: make compile-e2e - name: Test with coverage - run: sudo --preserve-env=CTR_SOCK_PATH make test-with-cov + run: | + export CTR_SOCK_PATH=/var/run/containerd/containerd.sock + make test-with-cov env: CTR_SOCK_PATH: /run/containerd/containerd.sock - name: Upload coverage to Codecov diff --git a/Makefile b/Makefile index 1514b8d63..7b1e1155a 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ test: ## Run unit tests .PHONY: test-with-cov test-with-cov: ## Run unit tests with coverage - go test -v -race -timeout 2m -p 1 -covermode=atomic -coverprofile=coverage.txt ./... + go test -v -race -timeout 2m -p 1 -covermode=atomic -coverprofile=coverage.txt -exec sudo ./... .PHONY: test-e2e test-e2e: compile-e2e ## Run e2e tests locally