Skip to content

test: RPC-level coverage for Routing + UnixFS.add #136

@lthibault

Description

@lthibault

Context

PR #134 added the Routing capability (routing.capnp, src/rpc/routing.rs) and UnixFS.add. The HTTP client layer is covered by integration tests (tests/routing_integration.rs, tests/ipfs_integration.rs), but the Cap'n Proto RPC server layer is untested.

Gaps

  • RoutingImpl RPC serverprovide() and find_providers() in src/rpc/routing.rs are not exercised through Cap'n Proto serialization.
  • ProviderSink streaming — the -> stream backpressure flow (build request, send, await, done) has zero test coverage. This is new Cap'n Proto syntax for us.
  • EpochGuardedUnixFS::add — the add method wired in src/rpc/membrane.rs has no RPC-level test.

Approach

ipfs::HttpClient is a concrete struct — mocking requires either:

  1. Refactoring behind a trait (allows unit tests with fake responses), or
  2. Spinning up a lightweight HTTP test server (e.g. wiremock) that mimics Kubo endpoints.

Option 1 is cleaner long-term. Option 2 is quicker.

Acceptance

  • RPC round-trip test for RoutingImpl::provide
  • RPC round-trip test for RoutingImpl::find_providers exercising ProviderSink streaming
  • RPC round-trip test for EpochGuardedUnixFS::add
  • Epoch guard rejection test for routing methods

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions