fermyon / spin-test

A utility for testing Spin applications
Apache License 2.0
17 stars 5 forks source link

Panic on unmatched route after wasi-fs changes #67

Closed itowlson closed 4 months ago

itowlson commented 4 months ago

Since #62, unmatched routes cause a panic instead of the "no route found in spin.toml manifest for request path '/'" error message. This occurs when unwrapping response_receiver.get() in the SDK perform_request method. The commit prior to #62 printed the error message. (I'm guessing any other kind of Err in the ResponseOutparam causes the same problem, but haven't substantiated this.)

Repro steps: change the trigger.http.route in examples/apps/app-rs/spin.toml to /x/... and run spin test. Previously it printed:

running 2 tests
In TEST: ENV_VAR=Err(NotPresent)
error when retrieving response: no route found in spin.toml manifest for request path '/'
test cache-hit  ... FAILED
error when retrieving response: no route found in spin.toml manifest for request path '/'
test cache-miss ... FAILED

Now it prints:

running 2 tests
thread '<unnamed>' panicked at crates/spin-test-sdk/src/lib.rs:22:29:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
In TEST: ENV_VAR=Err(NotPresent)
thread '<unnamed>' panicked at crates/spin-test-sdk/src/lib.rs:22:29:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test cache-miss ... FAILED
test cache-hit  ... FAILED

failures:

---- cache-miss ----
test 'spin-test-cache-miss' failed 
Caused by: error while executing at wasm backtrace:
    0: 0x794c0e - wasm_test.wasm!__rust_start_panic
    1: 0x794b68 - wasm_test.wasm!rust_panic
    2: 0x794aa1 - wasm_test.wasm!std::panicking::rust_panic_with_hook::hd3fb69bc0aea298a
    3: 0x793dbf - wasm_test.wasm!std::panicking::begin_panic_handler::{{closure}}::h4d99b90b43f79472
    4: 0x793ceb - wasm_test.wasm!std::sys_common::backtrace::__rust_end_short_backtrace::h5691573a73161cb1
    5: 0x794491 - wasm_test.wasm!rust_begin_unwind
    6: 0x799272 - wasm_test.wasm!core::panicking::panic_fmt::hdb62f5cdb45533e4
    7: 0x7996df - wasm_test.wasm!core::panicking::panic::h0d08f040be55464a
    8: 0x79aa90 - wasm_test.wasm!core::option::unwrap_failed::h5cf22e6c8f50e086
    9: 0x79051c - wasm_test.wasm!spin_test_sdk::perform_request::hb16c1855a0d2dc31
   10: 0x78e5ec - wasm_test.wasm!wasm_test::make_request::h8b8655bd9b9d0a48
   11: 0x78e76d - wasm_test.wasm!spin-test-cache-miss
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
Caused by: wasm trap: wasm `unreachable` instruction executed

# etc.