File tree Expand file tree Collapse file tree
bottlecap/src/lifecycle/invocation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -627,29 +627,6 @@ mod tests {
627627 } )
628628 }
629629
630- #[ test]
631- fn test_api_gateway_sets_dd_resource_key_for_rest_event ( ) {
632- let payload = api_gateway_rest_payload ( ) ;
633- let aws_config = aws_config ( "us-east-1" ) ;
634- let mut inferrer = SpanInferrer :: new ( Arc :: new ( Config :: default ( ) ) ) ;
635-
636- inferrer. infer_span ( & payload, & aws_config) ;
637-
638- let inferred_span = inferrer
639- . inferred_span
640- . as_ref ( )
641- . expect ( "Should have inferred API Gateway span" ) ;
642-
643- assert_eq ! (
644- inferred_span
645- . meta
646- . get( "dd_resource_key" )
647- . cloned( )
648- . unwrap_or_default( ) ,
649- "arn:aws:apigateway:us-east-1::/restapis/id"
650- ) ;
651- }
652-
653630 #[ test]
654631 fn test_complete_inferred_spans_propagates_appsec_from_invocation ( ) {
655632 let payload = api_gateway_rest_payload ( ) ;
Original file line number Diff line number Diff line change @@ -441,6 +441,18 @@ mod tests {
441441 ) ;
442442 }
443443
444+ #[ test]
445+ fn test_get_dd_resource_key ( ) {
446+ let json = read_json_file ( "api_gateway_http_event.json" ) ;
447+ let payload = serde_json:: from_str ( & json) . expect ( "Failed to deserialize into Value" ) ;
448+ let event =
449+ APIGatewayHttpEvent :: new ( payload) . expect ( "Failed to deserialize APIGatewayHttpEvent" ) ;
450+ assert_eq ! (
451+ event. get_dd_resource_key( "sa-east-1" ) ,
452+ Some ( "arn:aws:apigateway:sa-east-1::/apis/x02yirxc7a" . to_string( ) )
453+ ) ;
454+ }
455+
444456 #[ test]
445457 fn test_resolve_service_name_with_representation_enabled ( ) {
446458 let json = read_json_file ( "api_gateway_http_event.json" ) ;
Original file line number Diff line number Diff line change @@ -465,6 +465,18 @@ mod tests {
465465 ) ;
466466 }
467467
468+ #[ test]
469+ fn test_get_dd_resource_key ( ) {
470+ let json = read_json_file ( "api_gateway_rest_event.json" ) ;
471+ let payload = serde_json:: from_str ( & json) . expect ( "Failed to deserialize into Value" ) ;
472+ let event =
473+ APIGatewayRestEvent :: new ( payload) . expect ( "Failed to deserialize APIGatewayRestEvent" ) ;
474+ assert_eq ! (
475+ event. get_dd_resource_key( "us-east-1" ) ,
476+ Some ( "arn:aws:apigateway:us-east-1::/restapis/id" . to_string( ) )
477+ ) ;
478+ }
479+
468480 #[ test]
469481 fn test_resolve_service_name_with_representation_enabled ( ) {
470482 let json = read_json_file ( "api_gateway_rest_event.json" ) ;
You can’t perform that action at this time.
0 commit comments