@@ -164,52 +164,84 @@ pub async fn status(
164164 ..Default :: default ( )
165165 } ;
166166
167- tracing:: info!( "creating actor" ) ;
168- let res = actors_api:: actors_create (
169- & config,
170- models:: ActorsCreateActorRequest {
171- tags : Some ( serde_json:: json!( {
172- "name" : query. build. build_name( ) ,
173- } ) ) ,
174- build_tags : Some ( Some ( serde_json:: json!( {
175- "name" : query. build. build_name( ) ,
176- "current" : "true" ,
177- } ) ) ) ,
178- region : Some ( dc. name_id . clone ( ) ) ,
179- network : Some ( Box :: new ( models:: ActorsCreateActorNetworkRequest {
180- ports : Some ( HashMap :: from ( [ (
181- "http" . to_string ( ) ,
182- models:: ActorsCreateActorPortRequest {
183- protocol : models:: ActorsPortProtocol :: Https ,
184- routing : Some ( Box :: new ( models:: ActorsPortRouting {
185- guard : Some ( serde_json:: json!( { } ) ) ,
186- host : None ,
187- } ) ) ,
188- ..Default :: default ( )
189- } ,
190- ) ] ) ) ,
191- ..Default :: default ( )
192- } ) ) ,
193- lifecycle : Some ( Box :: new ( models:: ActorsLifecycle {
194- // Don't reboot on failure
195- durable : Some ( false ) ,
196- ..Default :: default ( )
197- } ) ) ,
198- resources : match & query. build {
199- StatusQueryBuild :: WsIsolate => None ,
200- StatusQueryBuild :: WsContainer => Some ( Box :: new ( models:: ActorsResources {
201- cpu : 100 ,
202- memory : 128 ,
203- } ) ) ,
204- } ,
167+ let body = models:: ActorsCreateActorRequest {
168+ tags : Some ( serde_json:: json!( {
169+ "name" : query. build. build_name( ) ,
170+ } ) ) ,
171+ build_tags : Some ( Some ( serde_json:: json!( {
172+ "name" : query. build. build_name( ) ,
173+ "current" : "true" ,
174+ } ) ) ) ,
175+ region : Some ( dc. name_id . clone ( ) ) ,
176+ network : Some ( Box :: new ( models:: ActorsCreateActorNetworkRequest {
177+ ports : Some ( HashMap :: from ( [ (
178+ "http" . to_string ( ) ,
179+ models:: ActorsCreateActorPortRequest {
180+ protocol : models:: ActorsPortProtocol :: Https ,
181+ routing : Some ( Box :: new ( models:: ActorsPortRouting {
182+ guard : Some ( serde_json:: json!( { } ) ) ,
183+ host : None ,
184+ } ) ) ,
185+ ..Default :: default ( )
186+ } ,
187+ ) ] ) ) ,
205188 ..Default :: default ( )
189+ } ) ) ,
190+ lifecycle : Some ( Box :: new ( models:: ActorsLifecycle {
191+ // Don't reboot on failure
192+ durable : Some ( false ) ,
193+ ..Default :: default ( )
194+ } ) ) ,
195+ resources : match & query. build {
196+ StatusQueryBuild :: WsIsolate => None ,
197+ StatusQueryBuild :: WsContainer => Some ( Box :: new ( models:: ActorsResources {
198+ cpu : 100 ,
199+ memory : 128 ,
200+ } ) ) ,
206201 } ,
202+ ..Default :: default ( )
203+ } ;
204+
205+ tracing:: info!( "creating actor" ) ;
206+ // Pass the request to the edge api
207+ use actors_api:: ActorsCreateError :: * ;
208+ let res = match actors_api:: actors_create (
209+ & config,
210+ body,
207211 Some ( & system_test_project) ,
208212 Some ( & system_test_env) ,
209213 None ,
210214 )
211- . instrument ( tracing:: info_span!( "actor_create_request" ) )
212- . await ?;
215+ . instrument ( tracing:: info_span!( "actor_create_request" , base_path=%config. base_path) )
216+ . await
217+ {
218+ Ok ( res) => res,
219+ Err ( rivet_api:: apis:: Error :: ResponseError ( content) ) => match content. entity {
220+ Some ( Status400 ( body) )
221+ | Some ( Status403 ( body) )
222+ | Some ( Status404 ( body) )
223+ | Some ( Status408 ( body) )
224+ | Some ( Status429 ( body) )
225+ | Some ( Status500 ( body) ) => {
226+ bail_with ! (
227+ INTERNAL_STATUS_CHECK_FAILED ,
228+ error = format!( "{}: {} (ray_id {})" , body. code, body. message, body. ray_id)
229+ ) ;
230+ }
231+ _ => {
232+ bail_with ! (
233+ INTERNAL_STATUS_CHECK_FAILED ,
234+ error = format!( "unknown request error: {:?} {:?}" , content. status, content. content)
235+ ) ;
236+ }
237+ } ,
238+ Err ( err) => {
239+ bail_with ! (
240+ INTERNAL_STATUS_CHECK_FAILED ,
241+ error = format!( "request error: {err:?}" )
242+ ) ;
243+ }
244+ } ;
213245 let actor_id = res. actor . id ;
214246
215247 tracing:: info!( ?actor_id, "created actor" ) ;
@@ -233,15 +265,46 @@ pub async fn status(
233265 . await ;
234266
235267 // Destroy actor regardless of connection status
236- actors_api:: actors_destroy (
237- & config,
238- & actor_id. to_string ( ) ,
239- Some ( & system_test_project) ,
240- Some ( & system_test_env) ,
241- None ,
242- )
243- . instrument ( tracing:: info_span!( "actor_destroy_request" ) )
244- . await ?;
268+ {
269+ use actors_api:: ActorsDestroyError :: * ;
270+ match actors_api:: actors_destroy (
271+ & config,
272+ & actor_id. to_string ( ) ,
273+ Some ( & system_test_project) ,
274+ Some ( & system_test_env) ,
275+ None ,
276+ )
277+ . instrument ( tracing:: info_span!( "actor_destroy_request" , base_path=%config. base_path) )
278+ . await
279+ {
280+ Ok ( _res) => { } ,
281+ Err ( rivet_api:: apis:: Error :: ResponseError ( content) ) => match content. entity {
282+ Some ( Status400 ( body) )
283+ | Some ( Status403 ( body) )
284+ | Some ( Status404 ( body) )
285+ | Some ( Status408 ( body) )
286+ | Some ( Status429 ( body) )
287+ | Some ( Status500 ( body) ) => {
288+ bail_with ! (
289+ INTERNAL_STATUS_CHECK_FAILED ,
290+ error = format!( "{}: {} (ray_id {})" , body. code, body. message, body. ray_id)
291+ ) ;
292+ }
293+ _ => {
294+ bail_with ! (
295+ INTERNAL_STATUS_CHECK_FAILED ,
296+ error = format!( "unknown request error: {:?} {:?}" , content. status, content. content)
297+ ) ;
298+ }
299+ } ,
300+ Err ( err) => {
301+ bail_with ! (
302+ INTERNAL_STATUS_CHECK_FAILED ,
303+ error = format!( "request error: {err:?}" )
304+ ) ;
305+ }
306+ }
307+ }
245308
246309 // Unwrap res
247310 match test_res {
0 commit comments