Poll `settings get` until the expected value and scope appear for a key.
(
sandbox_name: &str,
key: &str,
expected_value: &str,
expected_scope: &str,
timeout_duration: Duration,
)
| 92 | |
| 93 | /// Poll `settings get` until the expected value and scope appear for a key. |
| 94 | async fn wait_for_setting_value( |
| 95 | sandbox_name: &str, |
| 96 | key: &str, |
| 97 | expected_value: &str, |
| 98 | expected_scope: &str, |
| 99 | timeout_duration: Duration, |
| 100 | ) { |
| 101 | let needle = format!("{key} = {expected_value} ({expected_scope})"); |
| 102 | let start = Instant::now(); |
| 103 | loop { |
| 104 | let result = run_cli(&["settings", "get", sandbox_name]).await; |
| 105 | if result.success && result.clean_output.contains(&needle) { |
| 106 | return; |
| 107 | } |
| 108 | if start.elapsed() > timeout_duration { |
| 109 | panic!( |
| 110 | "timed out after {:?} waiting for setting line '{needle}' in output:\n{}", |
| 111 | timeout_duration, result.clean_output |
| 112 | ); |
| 113 | } |
| 114 | sleep(Duration::from_secs(1)).await; |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | #[tokio::test] |
| 119 | async fn settings_global_override_round_trip() { |
no test coverage detected