test: add coordinator mock tests and file-system pallet tests#148
Merged
mudigal merged 10 commits intoJun 10, 2026
Merged
Conversation
Add coordinator integration tests using mock chain clients (enabled by the trait extraction in PR 1) and file-system drive-registry success-path tests: - Agreement coordinator: mock chain client lifecycle tests - Challenge responder: mock chain client response tests - Checkpoint coordinator: mock chain client scheduling tests - Replica sync coordinator: mock chain client sync tests - Drive registry pallet: success-path tests for drive lifecycle
This was referenced Jun 8, 2026
…d-fs-pallet-tests
Align test mocks with the async_trait conversion in the coordinator trait definitions from the base branch.
…d-fs-pallet-tests
…d-fs-pallet-tests
ilchu
requested changes
Jun 10, 2026
ilchu
left a comment
Collaborator
There was a problem hiding this comment.
With this one there's quite a few improvements that could be had to make it snappier, but otherwise hooray for the extended coverage.
…d-fs-pallet-tests
Address PR #148 review feedback: - Merge 4 test binaries into tests/coordinators/ module for faster compile - Remove SharedMock wrappers (use Arc<T> directly via blanket impls) - Switch tokio::sync::Mutex to std::sync::Mutex in mocks - Add start_paused = true on tests that use tokio::time::sleep - Use full ALICE_SS58 constant instead of abridged addresses - Add shared wait_for() helper to replace inline timeout loops - Remove tautological variant-matching tests - Add test-util feature to tokio dev-dependency
…d-fs-pallet-tests
ilchu
approved these changes
Jun 10, 2026
…d-fs-pallet-tests
…d-fs-pallet-tests
mudigal
added a commit
that referenced
this pull request
Jun 10, 2026
* refactor(provider-node): extract chain traits for testability and harden CI Extract chain interaction traits from 4 coordinators (agreement, challenge, checkpoint, replica-sync) so each can be tested with mock chain clients. Move Subxt implementations to dedicated `_subxt.rs` files. - Add unified `ProviderError` type in `error.rs` - Wire `Box<dyn Trait>` in `command.rs` startup - Make `sign()` fallible across API handlers - Add testability helpers to `fs_index.rs` and `s3_index.rs` - CI: combine 3 pallet coverage jobs, glob discovery, validation guards - CI: fix integration test flakiness - Fix `//Bob` nonce issue in S3 CI integration test * test(provider-node): add HTTP and storage integration tests Add integration tests for the provider node's HTTP API layer: - API integration: all HTTP endpoints (upload, download, commit, checkpoint, etc.) - Auth integration: authentication middleware and signature verification - Disk integration: on-disk storage backend operations - FS integration: file-system API endpoint tests - S3 integration: S3-compatible API endpoint tests * refactor(provider-node): use #[async_trait] for coordinator traits, remove tempfile from PR 1 Replace manual `Pin<Box<dyn Future>>` return types with `#[async_trait]` across all 4 coordinator chain-client traits and their subxt impls: - AgreementChainClient - ChallengeChainClient - CheckpointChainClient - ReplicaSyncChainClient This preserves object safety (still `Box<dyn Trait>`) while making the code cleaner and easier to implement mock versions in tests. Also removes `tempfile` dev-dependency (unused in this PR; belongs in PR 3). * fix(provider-node): add tempfile dev-dependency for disk integration tests * refactor(provider-node): use subxt value! macro for dynamic value construction Replace verbose Value::named_composite/unnamed_variant calls with the scale_value::value! macro across all _subxt.rs files. Also shorten fully-qualified subxt::dynamic::Value:: paths with a use import. * refactor(provider-node): add blanket Arc<T> impls for coordinator traits Each coordinator trait now has an `impl<T: Trait> Trait for Arc<T>` that delegates to the inner value, eliminating the need for SharedMock newtype wrappers in tests. * refactor(provider-node): address PR #147 review feedback - Remove unnecessary sleep after tokio::spawn in disk test server - Convert MembershipResolver trait to use #[async_trait] for compact return signature instead of manual Pin<Box<dyn Future>> - Update ChainMembershipResolver and MockResolver impls accordingly * fix(ci): restore chain-spec-script resolution for SC integration tests The merge from dev incorrectly removed the "Resolve chain-spec script" step and left a reference to matrix.runtime.chain_spec_script which doesn't exist in this job (no matrix strategy). Restore the env var approach that reads from runtimes-matrix.json. * test: add coordinator mock tests and file-system pallet tests (#148) * test: add coordinator mock tests and file-system pallet tests Add coordinator integration tests using mock chain clients (enabled by the trait extraction in PR 1) and file-system drive-registry success-path tests: - Agreement coordinator: mock chain client lifecycle tests - Challenge responder: mock chain client response tests - Checkpoint coordinator: mock chain client scheduling tests - Replica sync coordinator: mock chain client sync tests - Drive registry pallet: success-path tests for drive lifecycle * refactor(tests): update mock trait impls to use #[async_trait] Align test mocks with the async_trait conversion in the coordinator trait definitions from the base branch. * test(provider-node): consolidate coordinator tests into single binary Address PR #148 review feedback: - Merge 4 test binaries into tests/coordinators/ module for faster compile - Remove SharedMock wrappers (use Arc<T> directly via blanket impls) - Switch tokio::sync::Mutex to std::sync::Mutex in mocks - Add start_paused = true on tests that use tokio::time::sleep - Use full ALICE_SS58 constant instead of abridged addresses - Add shared wait_for() helper to replace inline timeout loops - Remove tautological variant-matching tests - Add test-util feature to tokio dev-dependency --------- Co-authored-by: Ilia Churin <ilia@parity.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#144
Split from #139 (PR 4 of 4). Stacked on #147.
Add coordinator integration tests using mock chain clients (enabled by the trait extraction in #145) and file-system drive-registry success-path tests:
PR stack
devdevTest plan
SKIP_WASM_BUILD=1 cargo clippy -p storage-provider-node --all-targetspassescargo test -p storage-provider-node— all tests pass (HTTP + coordinator)cargo test -p pallet-drive-registry— drive registry tests pass