Skip to content

Commit

Permalink
Do not run tests with sudo
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Callisto13 committed Nov 10, 2021
1 parent fb643d7 commit 9efcd18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9efcd18

Please sign in to comment.