We think that is possible, and we are exploring adding the ICâs HTTP layer to PocketIc, which would make the agent libraries compatible and enable frontends. But this is currently in an early exploration stage and we cannot promise anything at this time.
If you have any other feedback or feature requests, we are happy to learn them.
@michael-weigelt
I would like to report a couple of issues we are encountering with PocketIC. Firstly, in version 2.1.0 of PocketIC, the default features of reqwest are not properly set to false. Consequently, both native-tls and rustls are enabled by default. This issue is causing complications in our CI build, where the use of OpenSSL is restricted, leading to failures in the build process.
Additionally, if a call is blocked by the inspect_message check, PocketIC currently panics instead of returning an error as expected. This behavior poses a challenge in testing the inspect_message functionality, as it prevents us from properly assessing its behavior.
Hi @ufoscout, weâve updated the PocketIC Rust crate to not use default features again, it will be released with the next release. Regarding the inspect_message check, could you please provide some more details where the panic is happening and where youâd expect an error? Maybe with a short code snippet, if thatâs possible! Thank you. Update: see @mraszykâs comment
If there is demand, perhaps. If you would find this useful, it would be helpful to know a specific test scenario that youâd like to make possible.
We are currently working on a feature that will make PocketIC compatible with the ICâs HTTP Interface. That is, it will be compatible with agent-based tools like DFX and other software that uses agent.rs / agent.js. This also sets the stage for frontend-dapp testing. So if these are your use cases, they are very likely coming soon, with certain caveats.
@michael-weigelt
For each of our canisters, we provide a fully-typed client. For instance, if the canister canister_one has a query endpoint get_name() -> String, invoking it through the client appears as follows:
// There are 4 supported backend types:
// 1. ic_backend: for canister-to-canister calls
// 2. ic-agent: for agent-to-canister calls
// 3. ic-state-machine-tests: for integration testing with state-machine-tests
// 4. pocket-ic: for integration testing with pocket-ic
let backend_type = ...;
// This is a fully-typed client for the CanisterOne canister
let canister_one_client = CanisterOneClient::new(backend_type);
// Performs a remote call to canister_one.
let endpoint_response = canister_one_client.get_name().await.unwrap();
The client has a single consistent API that can be used for testing and real scenarios.
The issue lies in the backend_type, as all types are asynchronous except for pocket-ic, which utilizes a blocking API. This necessitates wrapping each pocket-ic function call inside tokio::spawn_blocking, as shown below:
Hi @ufoscout, we have HTTP outcalls on the radar, but havenât specified a timeline yet, as we prioritize other features for now. Itâs definitely on the roadmap though!