As part of my work with Go bindings generation, I’d like to have a reliable way to test component implementations.
I’d like to have a Test component and an Implementation component where the Test component imports an interface exported by the Implementation component. Is there a process for combining the two components into a single component that, say, Wasmtime can run?
The Test component would use a world that combines wasi:cli/command
+ another world to test. The Implementation component would export the latter.
There is the wasm-tools compose
subcommand of the wasm-tools
CLI: https://github.com/bytecodealliance/wasm-tools
Or there is the Rust crate that does the same things as a library: https://crates.io/crates/wasm-compose
looks like the crate's README is a bit outdated
in the bit about implementation status
https://github.com/bytecodealliance/wasm-tools/pull/1447
I'll also drop a link to https://github.com/peterhuene/wac which is intended for compositions as well and is sort of the "next generation" of wasm-tools compose
, although it's still in development so it may not be suitable for all use cases yet
OK, thanks!
I'll also mention that the testing story in wit-bindgen is one I've always lamented is "not great". It's pretty heavyweight today and is one that I would love to improve, and what you're describing is a way I've wanted to try implementing before.
tl;dr; I like your idea, and if it works out I'd like to change wit-bindgen to a similar scheme
ideally one day I'd hope that there could be sort of a shared test suite for all bindings generators to easily use
That’d be great.
something like a straightforward invocation of a standard tool to compose a wasi:cli/command
+ another component + with a --test-world $WORLD
Last updated: Dec 23 2024 at 13:07 UTC