From 5391b1912bb48b1c5b00e108a718355781b8cd3e Mon Sep 17 00:00:00 2001 From: Tony Redondo Date: Thu, 10 Oct 2024 13:49:16 +0200 Subject: [PATCH] internal/civisibility: fix tests --- internal/civisibility/utils/ci_providers_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/civisibility/utils/ci_providers_test.go b/internal/civisibility/utils/ci_providers_test.go index f76a3a5446..8aeed064e7 100644 --- a/internal/civisibility/utils/ci_providers_test.go +++ b/internal/civisibility/utils/ci_providers_test.go @@ -118,6 +118,16 @@ func TestTags(t *testing.T) { } func TestGitHubEventFile(t *testing.T) { + originalEventPath := os.Getenv("GITHUB_EVENT_PATH") + originalBaseRef := os.Getenv("GITHUB_BASE_REF") + defer func() { + os.Setenv("GITHUB_EVENT_PATH", originalEventPath) + os.Setenv("GITHUB_BASE_REF", originalBaseRef) + }() + + os.Unsetenv("GITHUB_EVENT_PATH") + os.Unsetenv("GITHUB_BASE_REF") + checkValue := func(tags map[string]string, key, expectedValue string) { if tags[key] != expectedValue { t.Fatalf("Key: %s, the actual value (%s) is different to the expected value (%s)", key, tags[key], expectedValue)