@@ -24,57 +24,69 @@ func TestCloneRemoteStack(t *testing.T) {
24
24
wantErrStr string
25
25
}{
26
26
{
27
- "Case 1: Maven Java (Without subDir) " ,
28
- & schema.Git {
27
+ name : "Case 1: Maven Java" ,
28
+ git : & schema.Git {
29
29
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
30
30
RemoteName : "origin" ,
31
31
},
32
- filepath .Join (os .TempDir (), "springboot-ex" ),
33
- false ,
34
- "" ,
32
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
33
+ wantErr : false ,
34
+ wantErrStr : "" ,
35
35
},
36
36
{
37
- "Case 2: Maven Java (With subDir)" ,
38
- & schema.Git {
37
+ name : "Case 2: Maven Java (With subDir)" ,
38
+ git : & schema.Git {
39
39
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
40
40
RemoteName : "origin" ,
41
41
SubDir : "src/main" ,
42
42
},
43
- filepath .Join (os .TempDir (), "springboot-ex" ),
44
- false ,
45
- "" ,
43
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
44
+ wantErr : false ,
45
+ wantErrStr : "" ,
46
46
},
47
47
{
48
- "Case 3: Maven Java - Cloning with Hash Revision" ,
49
- & schema.Git {
48
+ name : "Case 3: Wildfly Java - microprofile-config subdirectory" ,
49
+ git : & schema.Git {
50
+ Url : "https://github.com/wildfly/quickstart.git" ,
51
+ RemoteName : "wildfly-quickstart" ,
52
+ Revision : "22.0.1.Final" ,
53
+ SubDir : "microprofile-config" ,
54
+ },
55
+ path : filepath .Join (os .TempDir (), "quickstart" ),
56
+ wantErr : false ,
57
+ wantErrStr : "" ,
58
+ },
59
+ {
60
+ name : "Case 4: Maven Java - Cloning with Hash Revision" ,
61
+ git : & schema.Git {
50
62
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
51
63
RemoteName : "origin" ,
52
64
Revision : "694e96286ffdc3a9990d0041637d32cecba38181" ,
53
65
},
54
- filepath .Join (os .TempDir (), "springboot-ex" ),
55
- true ,
56
- "specifying commit in 'revision' is not yet supported" ,
66
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
67
+ wantErr : true ,
68
+ wantErrStr : "specifying commit in 'revision' is not yet supported" ,
57
69
},
58
70
{
59
- "Case 4 : Cloning a non-existant repo" ,
60
- & schema.Git {
71
+ name : "Case 5 : Cloning a non-existent repo" ,
72
+ git : & schema.Git {
61
73
Url : "https://github.com/odo-devfiles/nonexist.git" ,
62
74
RemoteName : "origin" ,
63
75
},
64
- filepath .Join (os .TempDir (), "nonexist" ),
65
- true ,
66
- "" ,
76
+ path : filepath .Join (os .TempDir (), "nonexist" ),
77
+ wantErr : true ,
78
+ wantErrStr : "" ,
67
79
},
68
80
{
69
- "Case 5 : Maven Java - Cloning with Invalid Revision" ,
70
- & schema.Git {
81
+ name : "Case 6 : Maven Java - Cloning with Invalid Revision" ,
82
+ git : & schema.Git {
71
83
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
72
84
RemoteName : "origin" ,
73
85
Revision : "invalid" ,
74
86
},
75
- filepath .Join (os .TempDir (), "springboot-ex" ),
76
- true ,
77
- "couldn't find remote ref \" refs/tags/invalid\" " ,
87
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
88
+ wantErr : true ,
89
+ wantErrStr : "couldn't find remote ref \" refs/tags/invalid\" " ,
78
90
},
79
91
}
80
92
@@ -110,34 +122,34 @@ func TestDownloadStackFromZipUrl(t *testing.T) {
110
122
wantErrStr string
111
123
}{
112
124
{
113
- "Case 1: Java Quarkus (Without subDir) " ,
114
- map [string ]string {
125
+ name : "Case 1: Java Quarkus" ,
126
+ params : map [string ]string {
115
127
"Name" : "quarkus" ,
116
128
"ZipUrl" : "https://code.quarkus.io/d?e=io.quarkus%3Aquarkus-resteasy&e=io.quarkus%3Aquarkus-micrometer&e=io.quarkus%3Aquarkus-smallrye-health&e=io.quarkus%3Aquarkus-openshift&cn=devfile" ,
117
129
"SubDir" : "" ,
118
130
},
119
- false ,
120
- "" ,
131
+ wantErr : false ,
132
+ wantErrStr : "" ,
121
133
},
122
134
{
123
- "Case 2: Java Quarkus (With subDir)" ,
124
- map [string ]string {
135
+ name : "Case 2: Java Quarkus (With subDir)" ,
136
+ params : map [string ]string {
125
137
"Name" : "quarkus" ,
126
138
"ZipUrl" : "https://code.quarkus.io/d?e=io.quarkus%3Aquarkus-resteasy&e=io.quarkus%3Aquarkus-micrometer&e=io.quarkus%3Aquarkus-smallrye-health&e=io.quarkus%3Aquarkus-openshift&cn=devfile" ,
127
139
"SubDir" : "src" ,
128
140
},
129
- false ,
130
- "" ,
141
+ wantErr : false ,
142
+ wantErrStr : "" ,
131
143
},
132
144
{
133
- "Case 3: Download error" ,
134
- map [string ]string {
145
+ name : "Case 3: Download error" ,
146
+ params : map [string ]string {
135
147
"Name" : "quarkus" ,
136
148
"ZipUrl" : "https://code.quarkus.io/d?e=io.quarkus" ,
137
149
"SubDir" : "" ,
138
150
},
139
- true ,
140
- "failed to retrieve https://code.quarkus.io/d?e=io.quarkus, 400: Bad Request" ,
151
+ wantErr : true ,
152
+ wantErrStr : "failed to retrieve https://code.quarkus.io/d?e=io.quarkus, 400: Bad Request" ,
141
153
},
142
154
}
143
155
@@ -179,57 +191,69 @@ func TestDownloadStackFromGit(t *testing.T) {
179
191
wantErrStr string
180
192
}{
181
193
{
182
- "Case 1: Maven Java (Without subDir) " ,
183
- & schema.Git {
194
+ name : "Case 1: Maven Java" ,
195
+ git : & schema.Git {
184
196
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
185
197
RemoteName : "origin" ,
186
198
},
187
- filepath .Join (os .TempDir (), "springboot-ex" ),
188
- false ,
189
- "" ,
199
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
200
+ wantErr : false ,
201
+ wantErrStr : "" ,
190
202
},
191
203
{
192
- "Case 2: Maven Java (With subDir)" ,
193
- & schema.Git {
204
+ name : "Case 2: Maven Java (With subDir)" ,
205
+ git : & schema.Git {
194
206
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
195
207
RemoteName : "origin" ,
196
208
SubDir : "src/main" ,
197
209
},
198
- filepath .Join (os .TempDir (), "springboot-ex-main" ),
199
- false ,
200
- "" ,
210
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
211
+ wantErr : false ,
212
+ wantErrStr : "" ,
213
+ },
214
+ {
215
+ name : "Case 3: Wildfly Java - microprofile-config subdirectory" ,
216
+ git : & schema.Git {
217
+ Url : "https://github.com/wildfly/quickstart.git" ,
218
+ RemoteName : "wildfly-quickstart" ,
219
+ Revision : "22.0.1.Final" ,
220
+ SubDir : "microprofile-config" ,
221
+ },
222
+ path : filepath .Join (os .TempDir (), "quickstart" ),
223
+ wantErr : false ,
224
+ wantErrStr : "" ,
201
225
},
202
226
{
203
- "Case 3 : Maven Java - Cloning with Hash Revision" ,
204
- & schema.Git {
227
+ name : "Case 4 : Maven Java - Cloning with Hash Revision" ,
228
+ git : & schema.Git {
205
229
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
206
230
RemoteName : "origin" ,
207
231
Revision : "694e96286ffdc3a9990d0041637d32cecba38181" ,
208
232
},
209
- filepath .Join (os .TempDir (), "springboot-ex" ),
210
- true ,
211
- "specifying commit in 'revision' is not yet supported" ,
233
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
234
+ wantErr : true ,
235
+ wantErrStr : "specifying commit in 'revision' is not yet supported" ,
212
236
},
213
237
{
214
- "Case 4 : Cloning a non-existant repo" ,
215
- & schema.Git {
238
+ name : "Case 5 : Cloning a non-existent repo" ,
239
+ git : & schema.Git {
216
240
Url : "https://github.com/odo-devfiles/nonexist.git" ,
217
241
RemoteName : "origin" ,
218
242
},
219
- filepath .Join (os .TempDir (), "nonexist" ),
220
- true ,
221
- "" ,
243
+ path : filepath .Join (os .TempDir (), "nonexist" ),
244
+ wantErr : true ,
245
+ wantErrStr : "" ,
222
246
},
223
247
{
224
- "Case 5 : Maven Java - Cloning with Invalid Revision" ,
225
- & schema.Git {
248
+ name : "Case 6 : Maven Java - Cloning with Invalid Revision" ,
249
+ git : & schema.Git {
226
250
Url : "https://github.com/odo-devfiles/springboot-ex.git" ,
227
251
RemoteName : "origin" ,
228
252
Revision : "invalid" ,
229
253
},
230
- filepath .Join (os .TempDir (), "springboot-ex" ),
231
- true ,
232
- "couldn't find remote ref \" refs/tags/invalid\" " ,
254
+ path : filepath .Join (os .TempDir (), "springboot-ex" ),
255
+ wantErr : true ,
256
+ wantErrStr : "couldn't find remote ref \" refs/tags/invalid\" " ,
233
257
},
234
258
}
235
259
0 commit comments