@@ -65,6 +65,7 @@ use sled_agent_client::TestInterfaces as _;
65
65
use std:: convert:: TryFrom ;
66
66
use std:: net:: Ipv4Addr ;
67
67
use std:: sync:: Arc ;
68
+ use std:: time:: Duration ;
68
69
use uuid:: Uuid ;
69
70
70
71
use dropshot:: test_util:: ClientTestContext ;
@@ -77,6 +78,8 @@ use nexus_test_utils::resource_helpers::{
77
78
use nexus_test_utils_macros:: nexus_test;
78
79
use nexus_types:: external_api:: shared:: SiloRole ;
79
80
use omicron_sled_agent:: sim;
81
+ use omicron_test_utils:: dev:: poll;
82
+ use omicron_test_utils:: dev:: poll:: CondCheckError ;
80
83
81
84
type ControlPlaneTestContext =
82
85
nexus_test_utils:: ControlPlaneTestContext < omicron_nexus:: Server > ;
@@ -3537,10 +3540,22 @@ async fn test_instance_serial(cptestctx: &ControlPlaneTestContext) {
3537
3540
3538
3541
// Create an instance and poke it to ensure it's running.
3539
3542
let instance = create_instance ( client, PROJECT_NAME , instance_name) . await ;
3540
- instance_simulate ( nexus, & instance. identity . id ) . await ;
3541
- let instance_next = instance_get ( & client, & instance_url) . await ;
3543
+ let instance_next = poll:: wait_for_condition (
3544
+ || async {
3545
+ instance_simulate ( nexus, & instance. identity . id ) . await ;
3546
+ let instance_next = instance_get ( & client, & instance_url) . await ;
3547
+ if instance_next. runtime . run_state == InstanceState :: Running {
3548
+ Ok ( instance_next)
3549
+ } else {
3550
+ Err ( CondCheckError :: < ( ) > :: NotYet )
3551
+ }
3552
+ } ,
3553
+ & Duration :: from_secs ( 5 ) ,
3554
+ & Duration :: from_secs ( 60 ) ,
3555
+ )
3556
+ . await
3557
+ . unwrap ( ) ;
3542
3558
identity_eq ( & instance. identity , & instance_next. identity ) ;
3543
- assert_eq ! ( instance_next. runtime. run_state, InstanceState :: Running ) ;
3544
3559
assert ! (
3545
3560
instance_next. runtime. time_run_state_updated
3546
3561
> instance. runtime. time_run_state_updated
0 commit comments