Wait until a log line contains every needle.
(&self, needles: &[&str])
| 98 | impl Sandbox { |
| 99 | /// Wait until a log line contains every needle. |
| 100 | fn wait_for_log(&self, needles: &[&str]) { |
| 101 | let deadline = Instant::now() + Duration::from_secs(20); |
| 102 | while Instant::now() < deadline { |
| 103 | let log = self.log(); |
| 104 | if log |
| 105 | .lines() |
| 106 | .any(|line| needles.iter().all(|needle| line.contains(needle))) |
| 107 | { |
| 108 | return; |
| 109 | } |
| 110 | thread::sleep(Duration::from_millis(50)); |
| 111 | } |
| 112 | panic!("no line with {needles:?} in:\n{}", self.log()); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | /// The first log line containing every needle. |