diff --git a/libsql-server/tests/cluster/schema_dbs.rs b/libsql-server/tests/cluster/schema_dbs.rs index e9ab5036cc..6f49a174cb 100644 --- a/libsql-server/tests/cluster/schema_dbs.rs +++ b/libsql-server/tests/cluster/schema_dbs.rs @@ -98,8 +98,12 @@ fn schema_migration_basics() { .await .unwrap(); - assert_eq!( - conn.query("select count(*) from test", ()) + // The replica applies the delegated write asynchronously and the + // client does not give read-your-writes yet, so poll until it lands. + let mut count = 0; + for _ in 0..100 { + count = conn + .query("select count(*) from test", ()) .await .unwrap() .next() @@ -107,9 +111,13 @@ fn schema_migration_basics() { .unwrap() .unwrap() .get::(0) - .unwrap(), - 2 - ); + .unwrap(); + if count == 2 { + break; + } + tokio::time::sleep(std::time::Duration::from_millis(100)).await; + } + assert_eq!(count, 2); assert_eq!( conn.query("select count(*) from test2", ()) .await