File tree Expand file tree Collapse file tree
integration-tests/tests/agent_config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -392,23 +392,31 @@ async fn agent_reads_secret_after_canonicalized_update(
392392 )
393393 . await ?;
394394
395- let response = user
396- . invoke_and_await_agent (
397- & component,
398- & agent_id,
399- ctx. agent_method_name ( ) ,
400- data_value ! ( ) ,
401- )
402- . await ?
403- . into_return_value ( )
404- . ok_or_else ( || anyhow ! ( "expected return value" ) ) ?;
405-
406- let_assert ! ( Value :: String ( config) = response) ;
407-
408- let parsed: serde_json:: Value = serde_json:: from_str ( & config) ?;
395+ // There is a race here between the updated agent secret becoming visible and the invocation,
396+ // so poll until we see the new value
397+ let parsed_config: serde_json:: Value ;
398+ loop {
399+ let response = user
400+ . invoke_and_await_agent (
401+ & component,
402+ & agent_id,
403+ ctx. agent_method_name ( ) ,
404+ data_value ! ( ) ,
405+ )
406+ . await ?
407+ . into_return_value ( )
408+ . ok_or_else ( || anyhow ! ( "expected return value" ) ) ?;
409+
410+ let_assert ! ( Value :: String ( config) = response) ;
411+
412+ if config. contains ( "bar" ) {
413+ parsed_config = serde_json:: from_str ( & config) ?;
414+ break ;
415+ }
416+ }
409417
410418 assert_eq ! (
411- parsed ,
419+ parsed_config ,
412420 json!( {
413421 "secretPath" : "bar"
414422 } )
You can’t perform that action at this time.
0 commit comments