Skip to content

Commit e2d5de8

Browse files
committed
fixup! fixup! fixup! allow paralleltest
1 parent 1d937a0 commit e2d5de8

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

agent/agentcontainers/devcontainercli_test.go

+13-9
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ func TestDevcontainerCLI_ArgsAndParsing(t *testing.T) {
109109

110110
testExecer := &testDevcontainerExecer{
111111
testExePath: testExePath,
112-
extraEnv: []string{
113-
"TEST_DEVCONTAINER_WANT_ARGS=" + tt.wantArgs,
114-
"TEST_DEVCONTAINER_WANT_ERROR=" + fmt.Sprintf("%v", tt.wantError),
115-
"TEST_DEVCONTAINER_LOG_FILE=" + filepath.Join("testdata", "devcontainercli", "parse", tt.logFile),
116-
},
112+
wantArgs: tt.wantArgs,
113+
wantError: tt.wantError,
114+
outputFile: filepath.Join("testdata", "devcontainercli", "parse", tt.logFile),
117115
}
118116

119117
dccli := agentcontainers.NewDevcontainerCLI(logger, testExecer)
@@ -133,7 +131,9 @@ func TestDevcontainerCLI_ArgsAndParsing(t *testing.T) {
133131
// testDevcontainerExecer implements the agentexec.Execer interface for testing.
134132
type testDevcontainerExecer struct {
135133
testExePath string
136-
extraEnv []string
134+
wantArgs string
135+
wantError bool
136+
outputFile string
137137
}
138138

139139
// CommandContext returns a test binary command that simulates devcontainer responses.
@@ -155,9 +155,13 @@ func (e *testDevcontainerExecer) CommandContext(ctx context.Context, name string
155155

156156
//nolint:gosec // This is a test binary, so we don't need to worry about command injection.
157157
cmd := exec.CommandContext(ctx, e.testExePath, testArgs...)
158-
cmd.Env = append(os.Environ(), e.extraEnv...)
159-
// Set this environment va[riable so the child process knows it's the helper.
160-
cmd.Env = append(cmd.Env, "TEST_DEVCONTAINER_WANT_HELPER_PROCESS=1")
158+
// Set this environment variable so the child process knows it's the helper.
159+
cmd.Env = append(os.Environ(),
160+
"TEST_DEVCONTAINER_WANT_HELPER_PROCESS=1",
161+
"TEST_DEVCONTAINER_WANT_ARGS="+e.wantArgs,
162+
"TEST_DEVCONTAINER_WANT_ERROR="+fmt.Sprintf("%v", e.wantError),
163+
"TEST_DEVCONTAINER_LOG_FILE="+e.outputFile,
164+
)
161165

162166
return cmd
163167
}

0 commit comments

Comments
 (0)