Skip to content

Commit

Permalink
test: RPC provider API key modifications (#269)
Browse files Browse the repository at this point in the history
Follow-up testing and bugfixes for #252.

This PR...

* Adds state machine tests for the following scenarios:
  * Set the key for a provider that uses `RpcAuth::BearerToken`.
* Update a previously existing API key of some provider to `None`
removes it.
* Panic if trying to specify an API key for a provider that uses
`RpcAccess::Unauthenticated`
  * Panic if a provider is not found.
* Sets up the following canister upgrade tests:
  * Keep previously inserted API keys.
  * Change or keep demo status based on upgrade args.
* Change or keep principals allowed to manage API key providers based on
upgrade args.
* Includes unit tests for `BoolStorable` and `PrincipalStorable`.
* Removes unused `StringStorable`.
* Changes the `requestCost` canister method to return `0` when in demo
mode.
* Fixes the following bugs:
  * `BoolStorable` had an inverted condition in `from_bytes`
* `getProviderCost()` returned `Nat` instead of `Result<Nat, RpcError>`
in the state machine test logic

Note that the canister upgrade tests use the same Wasm before and after
upgrade. In the future (probably out of scope of this PR), we could
extend this to test upgrading from the most recently deployed canister's
Wasm file.
  • Loading branch information
rvanasa authored Sep 12, 2024
1 parent 98aed25 commit e2158f0
Show file tree
Hide file tree
Showing 7 changed files with 452 additions and 209 deletions.
Loading

0 comments on commit e2158f0

Please sign in to comment.