File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
rustv1/examples/bedrock-agent-runtime/src/bin Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ async fn process_agent_response_stream(
100100 }
101101 }
102102 _ => {
103- println ! ( "Received an unhandled event type from Bedrock stream." ) ;
103+ panic ! ( "received an unhandled event type from Bedrock stream" , ) ;
104104 }
105105 }
106106 }
@@ -109,6 +109,7 @@ async fn process_agent_response_stream(
109109
110110#[ cfg( test) ]
111111mod test {
112+
112113 use super :: * ;
113114
114115 #[ tokio:: test]
@@ -133,4 +134,19 @@ mod test {
133134
134135 assert_eq ! ( "test completion" , response) ;
135136 }
137+
138+ #[ tokio:: test]
139+ #[ should_panic( expected = "received an unhandled event type from Bedrock stream" ) ]
140+ async fn test_process_agent_response_stream_error ( ) {
141+ let mut mock = MockEventReceiverImpl :: default ( ) ;
142+ mock. expect_recv ( ) . times ( 1 ) . returning ( || {
143+ Ok ( Some (
144+ aws_sdk_bedrockagentruntime:: types:: ResponseStream :: Trace (
145+ aws_sdk_bedrockagentruntime:: types:: TracePart :: builder ( ) . build ( ) ,
146+ ) ,
147+ ) )
148+ } ) ;
149+
150+ let _ = process_agent_response_stream ( mock) . await . unwrap ( ) ;
151+ }
136152}
You can’t perform that action at this time.
0 commit comments