Skip to content

Commit d706429

Browse files
committed
Add turmoil test: integrity-check on nonexistent namespace returns 404
Symmetric to reset_replication_on_nonexistent_namespace_returns_404. If error handling regresses (e.g., accidentally returning 500 on NamespaceDoesntExist), the streamer's classifier would treat that as a transient server error and retry, instead of falling through to the optimistic-reset path. This test pins the correct behavior. 7 libsql turmoil tests total, all pass.
1 parent 1e7f7ad commit d706429

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

  • libsql-server/tests/namespaces

libsql-server/tests/namespaces/mod.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,37 @@ fn reset_replication_on_nonexistent_namespace_returns_404() {
303303
sim.run().unwrap();
304304
}
305305

306+
#[test]
307+
fn integrity_check_on_nonexistent_namespace_returns_404() {
308+
// Symmetric to reset_replication_on_nonexistent_namespace_returns_404.
309+
// If someone regresses error handling (e.g., returning 500 on
310+
// NamespaceDoesntExist), the streamer's classifier would treat that
311+
// as a transient server error and retry, instead of falling through
312+
// to the optimistic-reset path.
313+
let mut sim = Builder::new()
314+
.simulation_duration(Duration::from_secs(1000))
315+
.build();
316+
let tmp = tempdir().unwrap();
317+
make_primary(&mut sim, tmp.path().to_path_buf());
318+
319+
sim.client("client", async {
320+
let client = Client::new();
321+
let resp = client
322+
.post(
323+
"http://primary:9090/v1/namespaces/missing/integrity-check",
324+
json!({}),
325+
)
326+
.await;
327+
match resp {
328+
Ok(r) => assert_eq!(r.status(), hyper::http::StatusCode::NOT_FOUND),
329+
Err(e) => panic!("expected 404 response, got error: {e}"),
330+
}
331+
Ok(())
332+
});
333+
334+
sim.run().unwrap();
335+
}
336+
306337
#[test]
307338
fn integrity_check_defaults_to_quick_when_full_omitted() {
308339
// Verifies backward compatibility: if the request body is {} (no

0 commit comments

Comments
 (0)