@@ -906,9 +906,7 @@ async fn test_worker_boot_with_0_byte_eszip() {
906906 let result = create_test_user_worker ( opts) . await ;
907907
908908 assert ! ( result. is_err( ) ) ;
909- assert ! ( result
910- . unwrap_err( )
911- . to_string( )
909+ assert ! ( format!( "{:#}" , result. unwrap_err( ) )
912910 . starts_with( "worker boot error: unexpected end of file" ) ) ;
913911}
914912
@@ -934,10 +932,9 @@ async fn test_worker_boot_with_invalid_entrypoint() {
934932 let result = create_test_user_worker ( opts) . await ;
935933
936934 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+ ) ;
941938}
942939
943940#[ tokio:: test]
@@ -1552,11 +1549,6 @@ async fn test_decorators(ty: Option<DecoratorType>) {
15521549 ) ;
15531550}
15541551
1555- #[ derive( Deserialize ) ]
1556- struct ErrorResponsePayload {
1557- msg : String ,
1558- }
1559-
15601552#[ tokio:: test]
15611553#[ serial]
15621554async fn test_decorator_should_be_syntax_error ( ) {
@@ -2348,6 +2340,71 @@ async fn test_issue_420() {
23482340 ) ;
23492341}
23502342
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+
23512408trait AsyncReadWrite : AsyncRead + AsyncWrite + Send + Unpin { }
23522409
23532410impl < T > AsyncReadWrite for T where T : AsyncRead + AsyncWrite + Send + Unpin { }
0 commit comments