From a376424b1cf740144f19085e8bad9e4f3bd95c62 Mon Sep 17 00:00:00 2001 From: David Fridrich Date: Wed, 28 Aug 2024 16:53:21 +0200 Subject: [PATCH] test, remove window perm from workflow Signed-off-by: David Fridrich --- .github/workflows/test-unit.yaml | 6 ++++++ Makefile | 4 ++++ pkg/docker/creds/credentials_test.go | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-unit.yaml b/.github/workflows/test-unit.yaml index 6d02392ffb..cfb4536272 100644 --- a/.github/workflows/test-unit.yaml +++ b/.github/workflows/test-unit.yaml @@ -34,6 +34,12 @@ jobs: env: FUNC_REPO_REF: ${{ github.event.pull_request.head.repo.full_name }} FUNC_REPO_BRANCH_REF: ${{ github.head_ref }} + - name: Core Unit Linux/Mac Permission Test + if: matrix.os != 'windows-latest' + run: RUN_TARGET_TEST=TestCredentialsHomePermissions go test -run=TestCredentialsHomePermissions + env: + FUNC_REPO_REF: ${{ github.event.pull_request.head.repo.full_name }} + FUNC_REPO_BRANCH_REF: ${{ github.head_ref }} - name: Template Unit Tests run: make test-templates - name: "Archive code coverage results" diff --git a/Makefile b/Makefile index be37e4f5ac..d3d9753cb5 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,11 @@ $(BIN): generate/zz_filesystem_generated.go .PHONY: test test: generate/zz_filesystem_generated.go ## Run core unit tests +ifdef RUN_TARGET_TEST + go test -ldflags "$(LDFLAGS)" -race -cover -coverprofile=coverage.txt ./... -run=$(RUN_TARGET_TEST) +else go test -ldflags "$(LDFLAGS)" -race -cover -coverprofile=coverage.txt ./... +endif .PHONY: check check: $(BIN_GOLANGCI_LINT) ## Check code quality (lint) diff --git a/pkg/docker/creds/credentials_test.go b/pkg/docker/creds/credentials_test.go index 9edc53c6e1..5d3913802a 100644 --- a/pkg/docker/creds/credentials_test.go +++ b/pkg/docker/creds/credentials_test.go @@ -624,8 +624,14 @@ func TestCredentialsWithoutHome(t *testing.T) { // works in scenarios where HOME has different permissions func TestCredentialsHomePermissions(t *testing.T) { if runtime.GOOS == "windows" { - t.Skip("skip windows perms for this test until windows perms are added") // TODO: gauron99 fix this + t.Skip("skip windows perms for this test until windows perms are added") } + // run this test only in specific setting in GH Actions + if os.Getenv("RUN_TARGET_TEST") != "TestCredentialsHomePermissions" { + fmt.Printf("Skipping because RUN_TARGET_TEST variable wasnt specified") + t.Skip() + } + type args struct { promptUser creds.CredentialsCallback verifyCredentials creds.VerifyCredentialsCallback