Skip to content

Commit b63c337

Browse files
committed
Fix test: replace os.Unsetenv with t.Setenv for proper cleanup
os.Unsetenv doesn't participate in test cleanup and could pollute subsequent tests. Use t.Setenv with empty string instead.
1 parent 3ee39a6 commit b63c337

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

internal/oidc/oidc_registry_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package oidc
22

33
import (
44
"net/http/httptest"
5-
"os"
65
"testing"
76

87
"github.com/jarcoal/httpmock"
@@ -99,9 +98,9 @@ func TestOIDCRegistry_Register_FallsBackToHost(t *testing.T) {
9998
}
10099

101100
func TestOIDCRegistry_Register_NotOIDC(t *testing.T) {
102-
// Don't set OIDC env vars — CreateOIDCCredential will return nil
103-
os.Unsetenv(envActionsIDTokenRequestURL)
104-
os.Unsetenv(envActionsIDTokenRequestToken)
101+
// Ensure OIDC env vars are not set — CreateOIDCCredential will return nil
102+
t.Setenv(envActionsIDTokenRequestURL, "")
103+
t.Setenv(envActionsIDTokenRequestToken, "")
105104

106105
r := NewOIDCRegistry()
107106
cred := config.Credential{

0 commit comments

Comments
 (0)