Skip to content

Commit 2e88cd0

Browse files
committed
test(cluster): add startup wait to proxy_write test
The test panics with connection refused because it opens a database connection to replica0 before it is fully started. Add an HTTP-poll loop (matching the pattern used in replication.rs and other cluster tests) to wait for the replica's user API endpoint to become responsive before proceeding.
1 parent 42d2c2e commit 2e88cd0

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • libsql-server/tests/cluster

libsql-server/tests/cluster/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ fn proxy_write() {
9393
make_cluster(&mut sim, 1, true);
9494

9595
sim.client("client", async {
96+
let client = Client::new();
97+
// wait for replica to start up before connecting
98+
while client.get("http://replica0:8080/").await.is_err() {
99+
tokio::time::sleep(Duration::from_millis(100)).await;
100+
}
101+
96102
let db =
97103
Database::open_remote_with_connector("http://replica0:8080", "", TurmoilConnector)?;
98104
let conn = db.connect()?;

0 commit comments

Comments
 (0)