@@ -159,6 +159,7 @@ fn preboot(
159
159
pub fn http_smoke_test_template (
160
160
template_name : & str ,
161
161
template_url : Option < & str > ,
162
+ template_branch : Option < & str > ,
162
163
plugins : & [ & str ] ,
163
164
prebuild_hook : impl FnOnce ( & mut testing_framework:: TestEnvironment < ( ) > ) -> anyhow:: Result < ( ) > ,
164
165
build_env_vars : HashMap < String , String > ,
@@ -167,6 +168,7 @@ pub fn http_smoke_test_template(
167
168
http_smoke_test_template_with_route (
168
169
template_name,
169
170
template_url,
171
+ template_branch,
170
172
plugins,
171
173
prebuild_hook,
172
174
build_env_vars,
@@ -176,9 +178,12 @@ pub fn http_smoke_test_template(
176
178
}
177
179
178
180
/// Run a smoke test against a given http route for a `spin new` http template
181
+ // TODO: refactor this function to not take so many arguments
182
+ #[ allow( clippy:: too_many_arguments) ]
179
183
pub fn http_smoke_test_template_with_route (
180
184
template_name : & str ,
181
185
template_url : Option < & str > ,
186
+ template_branch : Option < & str > ,
182
187
plugins : & [ & str ] ,
183
188
prebuild_hook : impl FnOnce ( & mut testing_framework:: TestEnvironment < ( ) > ) -> anyhow:: Result < ( ) > ,
184
189
build_env_vars : HashMap < String , String > ,
@@ -188,6 +193,7 @@ pub fn http_smoke_test_template_with_route(
188
193
let mut env = bootstrap_smoke_test (
189
194
& testing_framework:: ServicesConfig :: none ( ) ,
190
195
template_url,
196
+ template_branch,
191
197
plugins,
192
198
template_name,
193
199
|_| Ok ( Vec :: new ( ) ) ,
@@ -211,6 +217,7 @@ pub fn http_smoke_test_template_with_route(
211
217
pub fn redis_smoke_test_template (
212
218
template_name : & str ,
213
219
template_url : Option < & str > ,
220
+ template_branch : Option < & str > ,
214
221
plugins : & [ & str ] ,
215
222
new_app_args : impl FnOnce ( u16 ) -> Vec < String > ,
216
223
prebuild_hook : impl FnOnce ( & mut testing_framework:: TestEnvironment < ( ) > ) -> anyhow:: Result < ( ) > ,
@@ -219,6 +226,7 @@ pub fn redis_smoke_test_template(
219
226
let mut env = bootstrap_smoke_test (
220
227
& testing_framework:: ServicesConfig :: new ( vec ! [ "redis" . into( ) ] ) ?,
221
228
template_url,
229
+ template_branch,
222
230
plugins,
223
231
template_name,
224
232
|env| {
@@ -261,6 +269,7 @@ static TEMPLATE_MUTEX: std::sync::Mutex<()> = std::sync::Mutex::new(());
261
269
pub fn bootstrap_smoke_test (
262
270
services : & testing_framework:: ServicesConfig ,
263
271
template_url : Option < & str > ,
272
+ template_branch : Option < & str > ,
264
273
plugins : & [ & str ] ,
265
274
template_name : & str ,
266
275
new_app_args : impl FnOnce (
@@ -281,6 +290,9 @@ pub fn bootstrap_smoke_test(
281
290
let template_url = template_url. unwrap_or ( "https://github.com/fermyon/spin" ) ;
282
291
let mut template_install = std:: process:: Command :: new ( spin_binary ( ) ) ;
283
292
template_install. args ( [ "templates" , "install" , "--git" , template_url, "--update" ] ) ;
293
+ if let Some ( branch) = template_branch {
294
+ template_install. args ( [ "--branch" , branch] ) ;
295
+ }
284
296
// We need to serialize template installs since they can't be run in parallel
285
297
{
286
298
let _guard = TEMPLATE_MUTEX . lock ( ) . unwrap ( ) ;
0 commit comments