Skip to content

Commit 484eab1

Browse files
committed
fix: treat NotFound from read_schema as SpiceDB ready in integration tests
SpiceDB returns NotFound ('No schema has been defined') when it's serving but has no schema written yet. The readiness check was treating this as a failure, causing all integration tests to fail after retries. Now the readiness probe accepts both Ok and NotFound as indicators that SpiceDB is up and serving gRPC requests.
1 parent 08f5d85 commit 484eab1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/integration.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ async fn spicedb() -> Arc<SharedSpiceDb> {
8686
for _ in 0..30 {
8787
match Client::new(&endpoint, SPICEDB_TOKEN).await {
8888
Ok(c) => match c.read_schema().await {
89+
// Schema read succeeded — SpiceDB is ready
8990
Ok(_) => {
9091
result = Some(c);
9192
break;
9293
}
94+
// NotFound means SpiceDB is serving but has no schema yet — that's ready
95+
Err(ref e) if e.code() == Some(tonic::Code::NotFound) => {
96+
result = Some(c);
97+
break;
98+
}
9399
Err(e) => {
94100
last_err = Some(format!("{e}"));
95101
tokio::time::sleep(std::time::Duration::from_millis(200)).await;

0 commit comments

Comments
 (0)