@@ -7,7 +7,7 @@ mod integration_tests {
7
7
http:: { Method , Request , Response } ,
8
8
services:: ServicesConfig ,
9
9
} ;
10
- use testing_framework:: runtimes:: SpinAppType ;
10
+ use testing_framework:: runtimes:: { spin_cli :: SpinConfig , SpinAppType } ;
11
11
12
12
use super :: testcases:: {
13
13
assert_spin_request, bootstap_env, http_smoke_test_template, run_test, spin_binary,
@@ -39,8 +39,11 @@ mod integration_tests {
39
39
let test_value = uuid:: Uuid :: new_v4 ( ) . to_string ( ) ;
40
40
run_test (
41
41
"key-value" ,
42
- SpinAppType :: Http ,
43
- [ "--key-value" . into ( ) , format ! ( "{test_key}={test_value}" ) ] ,
42
+ SpinConfig {
43
+ binary_path : spin_binary ( ) ,
44
+ spin_up_args : vec ! [ "--key-value" . into( ) , format!( "{test_key}={test_value}" ) ] ,
45
+ app_type : SpinAppType :: Http ,
46
+ } ,
44
47
ServicesConfig :: none ( ) ,
45
48
move |env| {
46
49
let spin = env. runtime_mut ( ) ;
@@ -59,8 +62,11 @@ mod integration_tests {
59
62
fn http_smoke_test ( ) -> anyhow:: Result < ( ) > {
60
63
run_test (
61
64
"http-smoke-test" ,
62
- SpinAppType :: Http ,
63
- [ ] ,
65
+ SpinConfig {
66
+ binary_path : spin_binary ( ) ,
67
+ spin_up_args : Vec :: new ( ) ,
68
+ app_type : SpinAppType :: Http ,
69
+ } ,
64
70
ServicesConfig :: none ( ) ,
65
71
move |env| {
66
72
let spin = env. runtime_mut ( ) ;
@@ -98,8 +104,11 @@ mod integration_tests {
98
104
use redis:: Commands ;
99
105
run_test (
100
106
"redis-smoke-test" ,
101
- SpinAppType :: Redis ,
102
- [ ] ,
107
+ SpinConfig {
108
+ binary_path : spin_binary ( ) ,
109
+ spin_up_args : Vec :: new ( ) ,
110
+ app_type : SpinAppType :: Redis ,
111
+ } ,
103
112
ServicesConfig :: new ( vec ! [ "redis" . into( ) ] ) ?,
104
113
move |env| {
105
114
let redis_port = env
@@ -153,8 +162,11 @@ mod integration_tests {
153
162
use crate :: testcases:: run_test_inited;
154
163
run_test_inited (
155
164
"otel-smoke-test" ,
156
- SpinAppType :: Http ,
157
- [ ] ,
165
+ SpinConfig {
166
+ binary_path : spin_binary ( ) ,
167
+ spin_up_args : Vec :: new ( ) ,
168
+ app_type : SpinAppType :: Http ,
169
+ } ,
158
170
ServicesConfig :: new ( vec ! [ "jaeger" . into( ) ] ) ?,
159
171
|env| {
160
172
let otel_port = env
@@ -212,8 +224,11 @@ mod integration_tests {
212
224
fn dynamic_env_test ( ) -> anyhow:: Result < ( ) > {
213
225
run_test (
214
226
"dynamic-env-test" ,
215
- SpinAppType :: Http ,
216
- vec ! [ "--env" . to_owned( ) , "foo=bar" . to_owned( ) ] ,
227
+ SpinConfig {
228
+ binary_path : spin_binary ( ) ,
229
+ spin_up_args : vec ! [ "--env" . to_owned( ) , "foo=bar" . to_owned( ) ] ,
230
+ app_type : SpinAppType :: Http ,
231
+ } ,
217
232
ServicesConfig :: none ( ) ,
218
233
move |env| {
219
234
let spin = env. runtime_mut ( ) ;
@@ -243,8 +258,11 @@ mod integration_tests {
243
258
fn assets_routing_test ( ) -> anyhow:: Result < ( ) > {
244
259
run_test (
245
260
"assets-test" ,
246
- SpinAppType :: Http ,
247
- [ ] ,
261
+ SpinConfig {
262
+ binary_path : spin_binary ( ) ,
263
+ spin_up_args : Vec :: new ( ) ,
264
+ app_type : SpinAppType :: Http ,
265
+ } ,
248
266
ServicesConfig :: none ( ) ,
249
267
move |env| {
250
268
let spin = env. runtime_mut ( ) ;
@@ -286,8 +304,11 @@ mod integration_tests {
286
304
fn legacy_apps ( ) -> anyhow:: Result < ( ) > {
287
305
run_test (
288
306
"legacy-apps-test" ,
289
- SpinAppType :: Http ,
290
- [ ] ,
307
+ SpinConfig {
308
+ binary_path : spin_binary ( ) ,
309
+ spin_up_args : Vec :: new ( ) ,
310
+ app_type : SpinAppType :: Http ,
311
+ } ,
291
312
ServicesConfig :: none ( ) ,
292
313
move |env| {
293
314
let spin = env. runtime_mut ( ) ;
@@ -314,9 +335,12 @@ mod integration_tests {
314
335
fn bad_build_test ( ) -> anyhow:: Result < ( ) > {
315
336
let mut env = bootstap_env (
316
337
"error" ,
317
- [ ] ,
338
+ SpinConfig {
339
+ binary_path : spin_binary ( ) ,
340
+ spin_up_args : Vec :: new ( ) ,
341
+ app_type : SpinAppType :: None ,
342
+ } ,
318
343
ServicesConfig :: none ( ) ,
319
- SpinAppType :: None ,
320
344
|_| Ok ( ( ) ) ,
321
345
) ?;
322
346
let expected = r#"Error: Couldn't find trigger executor for local app "spin.toml"
@@ -334,8 +358,11 @@ Caused by:
334
358
fn outbound_http_works ( ) -> anyhow:: Result < ( ) > {
335
359
run_test (
336
360
"outbound-http-to-same-app" ,
337
- SpinAppType :: Http ,
338
- [ ] ,
361
+ SpinConfig {
362
+ binary_path : spin_binary ( ) ,
363
+ spin_up_args : Vec :: new ( ) ,
364
+ app_type : SpinAppType :: Http ,
365
+ } ,
339
366
ServicesConfig :: none ( ) ,
340
367
move |env| {
341
368
let spin = env. runtime_mut ( ) ;
@@ -378,8 +405,11 @@ Caused by:
378
405
fn test_simple_rust_local ( ) -> anyhow:: Result < ( ) > {
379
406
run_test (
380
407
"simple-test" ,
381
- SpinAppType :: Http ,
382
- [ ] ,
408
+ SpinConfig {
409
+ binary_path : spin_binary ( ) ,
410
+ spin_up_args : Vec :: new ( ) ,
411
+ app_type : SpinAppType :: Http ,
412
+ } ,
383
413
ServicesConfig :: none ( ) ,
384
414
|env| {
385
415
let spin = env. runtime_mut ( ) ;
@@ -410,8 +440,11 @@ Caused by:
410
440
fn test_duplicate_rust_local ( ) -> anyhow:: Result < ( ) > {
411
441
run_test (
412
442
"simple-double-test" ,
413
- SpinAppType :: Http ,
414
- [ ] ,
443
+ SpinConfig {
444
+ binary_path : spin_binary ( ) ,
445
+ spin_up_args : Vec :: new ( ) ,
446
+ app_type : SpinAppType :: Http ,
447
+ } ,
415
448
ServicesConfig :: none ( ) ,
416
449
|env| {
417
450
let spin = env. runtime_mut ( ) ;
@@ -442,8 +475,11 @@ Caused by:
442
475
const VAULT_ROOT_TOKEN : & str = "root" ;
443
476
run_test_inited (
444
477
"vault-variables-test" ,
445
- SpinAppType :: Http ,
446
- vec ! [ "--runtime-config-file" . into( ) , "runtime_config.toml" . into( ) ] ,
478
+ SpinConfig {
479
+ binary_path : spin_binary ( ) ,
480
+ spin_up_args : vec ! [ "--runtime-config-file" . into( ) , "runtime_config.toml" . into( ) ] ,
481
+ app_type : SpinAppType :: Http ,
482
+ } ,
447
483
ServicesConfig :: new ( vec ! [ "vault" . into( ) ] ) ?,
448
484
|env| {
449
485
// Vault can take a few moments to be ready
@@ -745,8 +781,11 @@ Caused by:
745
781
746
782
run_test (
747
783
test_name,
748
- SpinAppType :: Http ,
749
- [ ] ,
784
+ SpinConfig {
785
+ binary_path : spin_binary ( ) ,
786
+ spin_up_args : Vec :: new ( ) ,
787
+ app_type : SpinAppType :: Http ,
788
+ } ,
750
789
ServicesConfig :: new ( vec ! [ "http-echo" . into( ) ] ) ?,
751
790
move |env| {
752
791
let port = env
@@ -788,10 +827,12 @@ route = "/..."
788
827
env. write_file ( "fake.wasm" , [ ] ) ?;
789
828
790
829
testing_framework:: runtimes:: spin_cli:: SpinCli :: start (
791
- & spin_binary ( ) ,
830
+ SpinConfig {
831
+ binary_path : spin_binary ( ) ,
832
+ spin_up_args : Vec :: new ( ) ,
833
+ app_type : SpinAppType :: None ,
834
+ } ,
792
835
& mut env,
793
- Vec :: < String > :: new ( ) ,
794
- SpinAppType :: None ,
795
836
) ?;
796
837
797
838
let mut up = std:: process:: Command :: new ( spin_binary ( ) ) ;
@@ -826,10 +867,12 @@ route = "/..."
826
867
env. write_file ( "fake.wasm" , [ ] ) ?;
827
868
828
869
testing_framework:: runtimes:: spin_cli:: SpinCli :: start (
829
- & spin_binary ( ) ,
870
+ SpinConfig {
871
+ binary_path : spin_binary ( ) ,
872
+ spin_up_args : Vec :: new ( ) ,
873
+ app_type : SpinAppType :: None ,
874
+ } ,
830
875
& mut env,
831
- Vec :: < String > :: new ( ) ,
832
- SpinAppType :: None ,
833
876
) ?;
834
877
835
878
let mut up = std:: process:: Command :: new ( spin_binary ( ) ) ;
@@ -1083,8 +1126,11 @@ route = "/..."
1083
1126
1084
1127
run_test (
1085
1128
"wasi-http-streaming" ,
1086
- SpinAppType :: Http ,
1087
- [ ] ,
1129
+ SpinConfig {
1130
+ binary_path : spin_binary ( ) ,
1131
+ spin_up_args : Vec :: new ( ) ,
1132
+ app_type : SpinAppType :: Http ,
1133
+ } ,
1088
1134
ServicesConfig :: none ( ) ,
1089
1135
move |env| {
1090
1136
let spin = env. runtime_mut ( ) ;
@@ -1130,8 +1176,11 @@ route = "/..."
1130
1176
. collect :: < HashMap < _ , _ > > ( ) ;
1131
1177
run_test (
1132
1178
"wasi-http-streaming" ,
1133
- SpinAppType :: Http ,
1134
- [ ] ,
1179
+ SpinConfig {
1180
+ binary_path : spin_binary ( ) ,
1181
+ spin_up_args : Vec :: new ( ) ,
1182
+ app_type : SpinAppType :: Http ,
1183
+ } ,
1135
1184
ServicesConfig :: new ( vec ! [ "http-responses-from-file" . into( ) ] ) ?,
1136
1185
move |env| {
1137
1186
let service_url = format ! (
@@ -1200,8 +1249,11 @@ route = "/..."
1200
1249
fn test_spin_inbound_http ( ) -> anyhow:: Result < ( ) > {
1201
1250
run_test (
1202
1251
"spin-inbound-http" ,
1203
- SpinAppType :: Http ,
1204
- [ ] ,
1252
+ SpinConfig {
1253
+ binary_path : spin_binary ( ) ,
1254
+ spin_up_args : Vec :: new ( ) ,
1255
+ app_type : SpinAppType :: Http ,
1256
+ } ,
1205
1257
ServicesConfig :: none ( ) ,
1206
1258
move |env| {
1207
1259
let spin = env. runtime_mut ( ) ;
@@ -1230,8 +1282,11 @@ route = "/..."
1230
1282
fn test_wagi_http ( ) -> anyhow:: Result < ( ) > {
1231
1283
run_test (
1232
1284
"wagi-http" ,
1233
- SpinAppType :: Http ,
1234
- [ ] ,
1285
+ SpinConfig {
1286
+ binary_path : spin_binary ( ) ,
1287
+ spin_up_args : Vec :: new ( ) ,
1288
+ app_type : SpinAppType :: Http ,
1289
+ } ,
1235
1290
ServicesConfig :: none ( ) ,
1236
1291
move |env| {
1237
1292
let spin = env. runtime_mut ( ) ;
@@ -1271,8 +1326,11 @@ route = "/..."
1271
1326
fn test_http_routing ( ) -> anyhow:: Result < ( ) > {
1272
1327
run_test (
1273
1328
"http-routing" ,
1274
- SpinAppType :: Http ,
1275
- [ ] ,
1329
+ SpinConfig {
1330
+ binary_path : spin_binary ( ) ,
1331
+ spin_up_args : Vec :: new ( ) ,
1332
+ app_type : SpinAppType :: Http ,
1333
+ } ,
1276
1334
ServicesConfig :: none ( ) ,
1277
1335
move |env| {
1278
1336
let spin = env. runtime_mut ( ) ;
@@ -1306,8 +1364,11 @@ route = "/..."
1306
1364
fn test_outbound_post ( ) -> anyhow:: Result < ( ) > {
1307
1365
run_test (
1308
1366
"wasi-http-outbound-post" ,
1309
- SpinAppType :: Http ,
1310
- [ ] ,
1367
+ SpinConfig {
1368
+ binary_path : spin_binary ( ) ,
1369
+ spin_up_args : Vec :: new ( ) ,
1370
+ app_type : SpinAppType :: Http ,
1371
+ } ,
1311
1372
ServicesConfig :: new ( vec ! [ "http-echo" . into( ) ] ) ?,
1312
1373
move |env| {
1313
1374
let service_url = format ! (
@@ -1395,8 +1456,11 @@ route = "/..."
1395
1456
fn test_spin_inbound_http_host_header ( ) -> anyhow:: Result < ( ) > {
1396
1457
run_test (
1397
1458
"outbound-http-to-same-app" ,
1398
- SpinAppType :: Http ,
1399
- [ ] ,
1459
+ SpinConfig {
1460
+ binary_path : spin_binary ( ) ,
1461
+ spin_up_args : Vec :: new ( ) ,
1462
+ app_type : SpinAppType :: Http ,
1463
+ } ,
1400
1464
ServicesConfig :: none ( ) ,
1401
1465
move |env| {
1402
1466
let spin = env. runtime_mut ( ) ;
0 commit comments