Skip to content

Commit

Permalink
test(deployment): use test_states in deployment_to_be_queued
Browse files Browse the repository at this point in the history
Instead of relying on a one second sleep.
  • Loading branch information
Kazy committed Jun 7, 2023
1 parent b2914b5 commit 2901f0f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions deployer/src/deployment/deploy_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,8 @@ mod tests {
// Send kill signal
deployment_manager.kill(id).await;

sleep(Duration::from_secs(1)).await;

let states = RECORDER.lock().unwrap().get_deployment_states(&id);

assert_eq!(
*states,
let test = test_states(
&id,
vec![
StateLog {
id,
Expand All @@ -664,8 +660,16 @@ mod tests {
id,
state: State::Stopped,
},
]
],
);

select! {
_ = sleep(Duration::from_secs(60)) => {
let states = RECORDER.lock().unwrap().get_deployment_states(&id);
panic!("states should go into 'Stopped' for a valid service: {:#?}", states);
},
_ = test => {}
};
}

#[tokio::test(flavor = "multi_thread")]
Expand Down

0 comments on commit 2901f0f

Please sign in to comment.