@@ -11,43 +11,48 @@ import (
11
11
"github.com/coder/coder/cli/clitest"
12
12
)
13
13
14
+ // nolint:paralleltest
14
15
func TestDotfiles (t * testing.T ) {
15
16
t .Run ("MissingArg" , func (t * testing.T ) {
16
- t .Parallel ()
17
17
cmd , _ := clitest .New (t , "dotfiles" )
18
18
err := cmd .Execute ()
19
19
assert .Error (t , err )
20
20
})
21
21
t .Run ("NoInstallScript" , func (t * testing.T ) {
22
- t .Parallel ()
23
22
_ , root := clitest .New (t )
24
23
testRepo := filepath .Join (string (root ), "test-repo" )
24
+
25
25
err := os .MkdirAll (testRepo , 0750 )
26
26
assert .NoError (t , err )
27
+
27
28
c := exec .Command ("git" , "init" )
28
29
c .Dir = testRepo
29
30
err = c .Run ()
30
31
assert .NoError (t , err )
32
+
31
33
// nolint:gosec
32
34
err = os .WriteFile (filepath .Join (testRepo , ".bashrc" ), []byte ("wow" ), 0750 )
33
35
assert .NoError (t , err )
36
+
34
37
c = exec .Command ("git" , "add" , ".bashrc" )
35
38
c .Dir = testRepo
36
39
err = c .Run ()
37
40
assert .NoError (t , err )
41
+
38
42
c = exec .Command ("git" , "commit" , "-m" , `"add .bashrc"` )
39
43
c .Dir = testRepo
40
44
err = c .Run ()
41
45
assert .NoError (t , err )
46
+
42
47
cmd , _ := clitest .New (t , "dotfiles" , "--global-config" , string (root ), "--home-dir" , string (root ), "-y" , testRepo )
43
48
err = cmd .Execute ()
44
49
assert .NoError (t , err )
50
+
45
51
b , err := os .ReadFile (filepath .Join (string (root ), ".bashrc" ))
46
52
assert .NoError (t , err )
47
53
assert .Equal (t , string (b ), "wow" )
48
54
})
49
55
t .Run ("InstallScript" , func (t * testing.T ) {
50
- t .Parallel ()
51
56
_ , root := clitest .New (t )
52
57
testRepo := filepath .Join (string (root ), "test-repo" )
53
58
err := os .MkdirAll (testRepo , 0750 )
0 commit comments