MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / wait_for_ping

Function wait_for_ping

atomic-cli/tests/database_owner_integration_test.rs:117–141  ·  view source on GitHub ↗
(repository: &std::path::Path, child: &mut Child)

Source from the content-addressed store, hash-verified

115}
116
117fn wait_for_ping(repository: &std::path::Path, child: &mut Child) -> Value {
118 let deadline = Instant::now() + Duration::from_secs(5);
119 loop {
120 let output = run_owner(repository, "ping");
121 if output.status.success() {
122 return serde_json::from_slice(&output.stdout).expect("parse ping response");
123 }
124 if let Some(status) = child.try_wait().expect("inspect owner process") {
125 let mut stderr = String::new();
126 child
127 .stderr
128 .take()
129 .expect("owner stderr")
130 .read_to_string(&mut stderr)
131 .expect("read owner stderr");
132 panic!("database owner exited with {status}: {stderr}");
133 }
134 assert!(
135 Instant::now() < deadline,
136 "database owner did not become healthy: {}",
137 String::from_utf8_lossy(&output.stderr)
138 );
139 thread::sleep(Duration::from_millis(25));
140 }
141}
142
143fn reserve(repository: &std::path::Path) -> Value {
144 let output = command_output(

Calls 2

run_ownerFunction · 0.85
successMethod · 0.80

Tested by

no test coverage detected