Skip to content

Commit 0fb1b42

Browse files
authored
Isolate TestParseGitReference from ambient env (#4813)
The subtests failed when `TOOLHIVE_DEV=true` was set in the shell environment. `isDevMode()` reads that variable, causing the function to use `http://` instead of `https://` and to skip SSRF rejection -- the opposite of what the non-dev test cases assert. Fix: remove `t.Parallel()` from `TestParseGitReference` and add `t.Setenv("TOOLHIVE_DEV", "")` so the test always runs in a clean environment, matching the pattern used by `TestParseGitReferenceDevMode`.
1 parent 1fa05ee commit 0fb1b42

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pkg/skills/gitresolver/reference_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ func TestIsGitReference(t *testing.T) {
3535
}
3636
}
3737

38+
//nolint:paralleltest // t.Setenv is incompatible with t.Parallel
3839
func TestParseGitReference(t *testing.T) {
39-
t.Parallel()
40+
// Ensure dev mode is off regardless of the ambient environment, so that
41+
// SSRF checks and https:// scheme selection are exercised as they would be
42+
// in production.
43+
t.Setenv("TOOLHIVE_DEV", "")
4044

4145
tests := []struct {
4246
name string
@@ -159,7 +163,6 @@ func TestParseGitReference(t *testing.T) {
159163

160164
for _, tt := range tests {
161165
t.Run(tt.name, func(t *testing.T) {
162-
t.Parallel()
163166
result, err := ParseGitReference(tt.input)
164167

165168
if tt.expectError != "" {

0 commit comments

Comments
 (0)