@@ -16,111 +16,111 @@ func TestDefaultWorkspaceFolder(t *testing.T) {
16
16
t .Parallel ()
17
17
18
18
successTests := []struct {
19
- name string
20
- workspacesFolder string
21
- gitURL string
22
- expected string
19
+ name string
20
+ baseDir string
21
+ gitURL string
22
+ expected string
23
23
}{
24
24
{
25
- name : "HTTP" ,
26
- workspacesFolder : "/workspaces" ,
27
- gitURL : "https://github.com/coder/envbuilder.git" ,
28
- expected : "/workspaces/envbuilder" ,
25
+ name : "HTTP" ,
26
+ baseDir : "/workspaces" ,
27
+ gitURL : "https://github.com/coder/envbuilder.git" ,
28
+ expected : "/workspaces/envbuilder" ,
29
29
},
30
30
{
31
- name : "SSH" ,
32
- workspacesFolder : "/workspaces" ,
33
- gitURL :
"[email protected] :coder/envbuilder.git" ,
34
- expected : "/workspaces/envbuilder" ,
31
+ name : "SSH" ,
32
+ baseDir : "/workspaces" ,
33
+ gitURL :
"[email protected] :coder/envbuilder.git" ,
34
+ expected : "/workspaces/envbuilder" ,
35
35
},
36
36
{
37
- name : "username and password" ,
38
- workspacesFolder : "/workspaces" ,
39
- gitURL :
"https://username:[email protected] /coder/envbuilder.git" ,
40
- expected : "/workspaces/envbuilder" ,
37
+ name : "username and password" ,
38
+ baseDir : "/workspaces" ,
39
+ gitURL :
"https://username:[email protected] /coder/envbuilder.git" ,
40
+ expected : "/workspaces/envbuilder" ,
41
41
},
42
42
{
43
- name : "trailing" ,
44
- workspacesFolder : "/workspaces" ,
45
- gitURL : "https://github.com/coder/envbuilder.git/" ,
46
- expected : "/workspaces/envbuilder" ,
43
+ name : "trailing" ,
44
+ baseDir : "/workspaces" ,
45
+ gitURL : "https://github.com/coder/envbuilder.git/" ,
46
+ expected : "/workspaces/envbuilder" ,
47
47
},
48
48
{
49
- name : "trailing-x2" ,
50
- workspacesFolder : "/workspaces" ,
51
- gitURL : "https://github.com/coder/envbuilder.git//" ,
52
- expected : "/workspaces/envbuilder" ,
49
+ name : "trailing-x2" ,
50
+ baseDir : "/workspaces" ,
51
+ gitURL : "https://github.com/coder/envbuilder.git//" ,
52
+ expected : "/workspaces/envbuilder" ,
53
53
},
54
54
{
55
- name : "no .git" ,
56
- workspacesFolder : "/workspaces" ,
57
- gitURL : "https://github.com/coder/envbuilder" ,
58
- expected : "/workspaces/envbuilder" ,
55
+ name : "no .git" ,
56
+ baseDir : "/workspaces" ,
57
+ gitURL : "https://github.com/coder/envbuilder" ,
58
+ expected : "/workspaces/envbuilder" ,
59
59
},
60
60
{
61
- name : "trailing no .git" ,
62
- workspacesFolder : "/workspaces" ,
63
- gitURL : "https://github.com/coder/envbuilder/" ,
64
- expected : "/workspaces/envbuilder" ,
61
+ name : "trailing no .git" ,
62
+ baseDir : "/workspaces" ,
63
+ gitURL : "https://github.com/coder/envbuilder/" ,
64
+ expected : "/workspaces/envbuilder" ,
65
65
},
66
66
{
67
- name : "fragment" ,
68
- workspacesFolder : "/workspaces" ,
69
- gitURL : "https://github.com/coder/envbuilder.git#feature-branch" ,
70
- expected : "/workspaces/envbuilder" ,
67
+ name : "fragment" ,
68
+ baseDir : "/workspaces" ,
69
+ gitURL : "https://github.com/coder/envbuilder.git#feature-branch" ,
70
+ expected : "/workspaces/envbuilder" ,
71
71
},
72
72
{
73
- name : "fragment-trailing" ,
74
- workspacesFolder : "/workspaces" ,
75
- gitURL : "https://github.com/coder/envbuilder.git/#refs/heads/feature-branch" ,
76
- expected : "/workspaces/envbuilder" ,
73
+ name : "fragment-trailing" ,
74
+ baseDir : "/workspaces" ,
75
+ gitURL : "https://github.com/coder/envbuilder.git/#refs/heads/feature-branch" ,
76
+ expected : "/workspaces/envbuilder" ,
77
77
},
78
78
{
79
- name : "fragment-trailing no .git" ,
80
- workspacesFolder : "/workspaces" ,
81
- gitURL : "https://github.com/coder/envbuilder/#refs/heads/feature-branch" ,
82
- expected : "/workspaces/envbuilder" ,
79
+ name : "fragment-trailing no .git" ,
80
+ baseDir : "/workspaces" ,
81
+ gitURL : "https://github.com/coder/envbuilder/#refs/heads/feature-branch" ,
82
+ expected : "/workspaces/envbuilder" ,
83
83
},
84
84
{
85
- name : "space" ,
86
- workspacesFolder : "/workspaces" ,
87
- gitURL : "https://github.com/coder/env%20builder.git" ,
88
- expected : "/workspaces/env builder" ,
85
+ name : "space" ,
86
+ baseDir : "/workspaces" ,
87
+ gitURL : "https://github.com/coder/env%20builder.git" ,
88
+ expected : "/workspaces/env builder" ,
89
89
},
90
90
{
91
- name : "Unix path" ,
92
- workspacesFolder : "/workspaces" ,
93
- gitURL : "/repo" ,
94
- expected : "/workspaces/repo" ,
91
+ name : "Unix path" ,
92
+ baseDir : "/workspaces" ,
93
+ gitURL : "/repo" ,
94
+ expected : "/workspaces/repo" ,
95
95
},
96
96
{
97
- name : "Unix subpath" ,
98
- workspacesFolder : "/workspaces" ,
99
- gitURL : "/path/to/repo" ,
100
- expected : "/workspaces/repo" ,
97
+ name : "Unix subpath" ,
98
+ baseDir : "/workspaces" ,
99
+ gitURL : "/path/to/repo" ,
100
+ expected : "/workspaces/repo" ,
101
101
},
102
102
{
103
- name : "empty" ,
104
- workspacesFolder : "/workspaces" ,
105
- gitURL : "" ,
106
- expected : "/workspaces/empty" ,
103
+ name : "empty" ,
104
+ baseDir : "/workspaces" ,
105
+ gitURL : "" ,
106
+ expected : "/workspaces/empty" ,
107
107
},
108
108
{
109
- name : "non default workspaces folder" ,
110
- workspacesFolder : "/foo" ,
111
- gitURL : "https://github.com/coder/envbuilder.git" ,
112
- expected : "/foo/envbuilder" ,
109
+ name : "non default workspaces folder" ,
110
+ baseDir : "/foo" ,
111
+ gitURL : "https://github.com/coder/envbuilder.git" ,
112
+ expected : "/foo/envbuilder" ,
113
113
},
114
114
{
115
- name : "non default workspaces folder empty git URL" ,
116
- workspacesFolder : "/foo" ,
117
- gitURL : "" ,
118
- expected : "/foo/empty" ,
115
+ name : "non default workspaces folder empty git URL" ,
116
+ baseDir : "/foo" ,
117
+ gitURL : "" ,
118
+ expected : "/foo/empty" ,
119
119
},
120
120
}
121
121
for _ , tt := range successTests {
122
122
t .Run (tt .name , func (t * testing.T ) {
123
- dir := options .DefaultWorkspaceFolder (tt .workspacesFolder , tt .gitURL )
123
+ dir := options .DefaultWorkspaceFolder (tt .baseDir , tt .gitURL )
124
124
require .Equal (t , tt .expected , dir )
125
125
})
126
126
}
@@ -167,7 +167,7 @@ func TestOptions_SetDefaults(t *testing.T) {
167
167
IgnorePaths : []string {"/var/run" , "/product_uuid" , "/product_name" },
168
168
Filesystem : chmodfs .New (osfs .New ("/" )),
169
169
GitURL : "" ,
170
- WorkspacesFolder : "/workspaces" ,
170
+ WorkspaceBaseDir : "/workspaces" ,
171
171
WorkspaceFolder : "/workspaces/empty" ,
172
172
WorkingDirBase : "/.envbuilder" ,
173
173
BinaryPath : "/.envbuilder/bin/envbuilder" ,
0 commit comments