test(relay): rebuild state when switching private-read auth mode

Ingest can leave other references to the shared AppState alive, so Arc::get_mut panicked in CI. Clone the cheap-clone state and rewrap it, as other relay tests do.

Signed-off-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
This commit is contained in:
Larry
2026-10-02 14:49:24 -04:00
parent e78761ca03
commit 0e8bcdc5fd

View File

@@ -116,7 +116,11 @@ async fn existing_private_reads_preserve_visible_pages_and_counts() {
// Exercise the existing production NIP-98 contract and development X-Pubkey
// contract. Both must page/count using the reader selected by that mode.
for strict in [false, true] {
Arc::make_mut(&mut Arc::get_mut(&mut state).unwrap().config).require_auth_token = strict;
// Ingest may leave background clones of the shared state alive, so
// rebuild the cheap-clone state instead of requiring a unique Arc.
let mut next = (*state).clone();
Arc::make_mut(&mut next.config).require_auth_token = strict;
state = Arc::new(next);
for route in ["/query", "/count"] {
if strict {
let (status, result) = post(&state, &host, route, &owner, own.clone(), false).await;