@@ -12,9 +12,10 @@ import (
12
12
"github.com/coder/coder/v2/agent/agentexec"
13
13
)
14
14
15
+ //nolint:paralleltest // we need to test environment variables
15
16
func TestExec (t * testing.T ) {
17
+ //nolint:paralleltest // we need to test environment variables
16
18
t .Run ("NonLinux" , func (t * testing.T ) {
17
-
18
19
t .Setenv (agentexec .EnvProcPrioMgmt , "true" )
19
20
20
21
if runtime .GOOS == "linux" {
@@ -23,12 +24,16 @@ func TestExec(t *testing.T) {
23
24
24
25
cmd , err := agentexec .CommandContext (context .Background (), "sh" , "-c" , "sleep" )
25
26
require .NoError (t , err )
26
- require .Equal (t , "sh" , cmd .Path )
27
- require .Equal (t , []string {"-c" , "sleep" }, cmd .Args [1 :])
27
+
28
+ path , err := exec .LookPath ("sh" )
29
+ require .NoError (t , err )
30
+ require .Equal (t , path , cmd .Path )
31
+ require .Equal (t , []string {"sh" , "-c" , "sleep" }, cmd .Args )
28
32
})
29
33
34
+ //nolint:paralleltest // we need to test environment variables
30
35
t .Run ("Linux" , func (t * testing.T ) {
31
-
36
+ //nolint:paralleltest // we need to test environment variables
32
37
t .Run ("Disabled" , func (t * testing.T ) {
33
38
if runtime .GOOS != "linux" {
34
39
t .Skip ("skipping on linux" )
@@ -42,6 +47,7 @@ func TestExec(t *testing.T) {
42
47
require .Equal (t , []string {"sh" , "-c" , "sleep" }, cmd .Args )
43
48
})
44
49
50
+ //nolint:paralleltest // we need to test environment variables
45
51
t .Run ("Enabled" , func (t * testing.T ) {
46
52
t .Setenv (agentexec .EnvProcPrioMgmt , "hello" )
47
53
0 commit comments