Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fixture framework capable of passing native fixtures to Wasm code #1799

Open
Twey opened this issue Mar 20, 2024 · 0 comments
Open

Add fixture framework capable of passing native fixtures to Wasm code #1799

Twey opened this issue Mar 20, 2024 · 0 comments

Comments

@Twey
Copy link
Contributor

Twey commented Mar 20, 2024

As part of #1738, I added a test to linera-rpc that connects to a running Linera proxy and gets its version. This test can be successfully run both natively and in the browser with wasm-pack test, but currently requires hard-coding the server port, meaning it cannot be run normally/directly with cargo test or wasm-pack testlinera net up must first be run to start the server on port 9000.

We find ourselves generally in need of a way of handling fixtures in tests for several use cases:

  • table names must be unique in the DynamoDB and ScyllaDB storage tests: we are currently using a random number generator to (hopefully) make them unique, but this makes the tests non-deterministic and unable to run on bare Wasm
  • the storage backend could be shared between tests (using the storage service), but passing the storage service into tests is difficult without hard-coding its address
  • the local linera-service tests currently bring up a new Linera net for each test using test_case to list descriptions of net configurations

rstest supports fixtures, and can be used for some of this, but has two drawbacks that add friction for our use cases:

  • while it supports #[once] fixtures that are held across the whole suite, the destructors for those fixtures are never called, meaning that we can't bring down the fixture (e.g. net) after testing ready for the next test suite
  • it doesn't provide a way for the fixtures to run on the host, which is necessary when cross-testing (e.g. for Wasm)
@Twey Twey mentioned this issue Mar 20, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant