@@ -906,9 +906,7 @@ async fn test_worker_boot_with_0_byte_eszip() {
906
906
let result = create_test_user_worker ( opts) . await ;
907
907
908
908
assert ! ( result. is_err( ) ) ;
909
- assert ! ( result
910
- . unwrap_err( )
911
- . to_string( )
909
+ assert ! ( format!( "{:#}" , result. unwrap_err( ) )
912
910
. starts_with( "worker boot error: unexpected end of file" ) ) ;
913
911
}
914
912
@@ -934,10 +932,9 @@ async fn test_worker_boot_with_invalid_entrypoint() {
934
932
let result = create_test_user_worker ( opts) . await ;
935
933
936
934
assert ! ( result. is_err( ) ) ;
937
- assert ! ( result
938
- . unwrap_err( )
939
- . to_string( )
940
- . starts_with( "worker boot error: failed to read path" ) ) ;
935
+ assert ! (
936
+ format!( "{:#}" , result. unwrap_err( ) ) . starts_with( "worker boot error: failed to read path" )
937
+ ) ;
941
938
}
942
939
943
940
#[ tokio:: test]
@@ -1552,11 +1549,6 @@ async fn test_decorators(ty: Option<DecoratorType>) {
1552
1549
) ;
1553
1550
}
1554
1551
1555
- #[ derive( Deserialize ) ]
1556
- struct ErrorResponsePayload {
1557
- msg : String ,
1558
- }
1559
-
1560
1552
#[ tokio:: test]
1561
1553
#[ serial]
1562
1554
async fn test_decorator_should_be_syntax_error ( ) {
@@ -2348,6 +2340,71 @@ async fn test_issue_420() {
2348
2340
) ;
2349
2341
}
2350
2342
2343
+ #[ tokio:: test]
2344
+ #[ serial]
2345
+ async fn test_should_render_detailed_failed_to_create_graph_error ( ) {
2346
+ {
2347
+ integration_test ! (
2348
+ "./test_cases/main" ,
2349
+ NON_SECURE_PORT ,
2350
+ "graph-error-1" ,
2351
+ None ,
2352
+ None ,
2353
+ None ,
2354
+ None ,
2355
+ ( |resp| async {
2356
+ let ( payload, status) = ErrorResponsePayload :: assert_error_response( resp) . await ;
2357
+
2358
+ assert_eq!( status, 500 ) ;
2359
+ assert!( payload. msg. starts_with(
2360
+ "InvalidWorkerCreation: worker boot error: failed to create the graph: \
2361
+ Relative import path \" oak\" not prefixed with"
2362
+ ) ) ;
2363
+ } ) ,
2364
+ TerminationToken :: new( )
2365
+ ) ;
2366
+ }
2367
+
2368
+ {
2369
+ integration_test ! (
2370
+ "./test_cases/main" ,
2371
+ NON_SECURE_PORT ,
2372
+ "graph-error-2" ,
2373
+ None ,
2374
+ None ,
2375
+ None ,
2376
+ None ,
2377
+ ( |resp| async {
2378
+ let ( payload, status) = ErrorResponsePayload :: assert_error_response( resp) . await ;
2379
+
2380
+ assert_eq!( status, 500 ) ;
2381
+ assert!( payload. msg. starts_with(
2382
+ "InvalidWorkerCreation: worker boot error: failed to create the graph: \
2383
+ Module not found \" file://"
2384
+ ) ) ;
2385
+ } ) ,
2386
+ TerminationToken :: new( )
2387
+ ) ;
2388
+ }
2389
+ }
2390
+
2391
+ #[ derive( Deserialize ) ]
2392
+ struct ErrorResponsePayload {
2393
+ msg : String ,
2394
+ }
2395
+
2396
+ impl ErrorResponsePayload {
2397
+ async fn assert_error_response ( resp : Result < Response , reqwest:: Error > ) -> ( Self , u16 ) {
2398
+ let res = resp. unwrap ( ) ;
2399
+ let status = res. status ( ) . as_u16 ( ) ;
2400
+ let res = res. json :: < Self > ( ) . await ;
2401
+
2402
+ assert ! ( res. is_ok( ) ) ;
2403
+
2404
+ ( res. unwrap ( ) , status)
2405
+ }
2406
+ }
2407
+
2351
2408
trait AsyncReadWrite : AsyncRead + AsyncWrite + Send + Unpin { }
2352
2409
2353
2410
impl < T > AsyncReadWrite for T where T : AsyncRead + AsyncWrite + Send + Unpin { }
0 commit comments