You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.2 KiB
2.2 KiB
| title | status | type | priority | created_at | updated_at |
|---|---|---|---|---|---|
| [TRIAGE] Test harness: how to import and start quotesdb-api in tests (workers-rs vs native build target) | completed | task | critical | 2026-03-10T23:32:06Z | 2026-03-10T23:32:06Z |
The cfg(target_arch) approach in Cargo.toml means that when cargo test runs on the native
host, the workers-rs crate is never pulled in (it is a [target.'cfg(target_arch = "wasm32")'.dependencies]
entry). The native Axum server path compiles automatically.
Integration tests in tests/ start the server by calling a spawn_test_server() helper that:
- Opens an in-memory or temp-file rusqlite DB (via
NativeRepository) - Calls
router::build_router(repo)to get the AxumRouter - Binds to a random port with
tokio::net::TcpListener::bind("127.0.0.1:0") - Spawns the server with
tokio::spawn(axum::serve(listener, app)) - Returns
(base_url, shutdown_handle)
No wrangler dev, no separate binary, no feature flags. Standard cargo test workflow.
Resolved as part of TRIAGE e8a330 and a91260 (cfg-split architecture decision).
See implementation ticket 00aff0 for the DB abstraction details and ticket 9b581f for the test harness implementation.
`chore(quotesdb): resolve triage — test-harness-how-to-import-and-start-quotesdbapi-in-tests-wo`