(name: &str, timeout_secs: u64)
| 81 | } |
| 82 | |
| 83 | async fn wait_for_sandbox(name: &str, timeout_secs: u64) -> Result<(), String> { |
| 84 | let deadline = tokio::time::Instant::now() + Duration::from_secs(timeout_secs); |
| 85 | while tokio::time::Instant::now() < deadline { |
| 86 | if let Ok(n) = kubectl(&[ |
| 87 | "get", "sandbox", name, "-n", "openshell", |
| 88 | "-o", "jsonpath={.metadata.name}", |
| 89 | ]).await { |
| 90 | if !n.trim().is_empty() { |
| 91 | return Ok(()); |
| 92 | } |
| 93 | } |
| 94 | tokio::time::sleep(Duration::from_secs(2)).await; |
| 95 | } |
| 96 | Err(format!("sandbox {name} did not appear within {timeout_secs}s")) |
| 97 | } |
| 98 | |
| 99 | /// Find a sandbox pod by its sandbox CRD name. The CRD controller creates a |
| 100 | /// pod with the same name as the Sandbox resource. |
no test coverage detected