Skip to content

test(transfer): cover the pre-scan time-box branch (slow-backend fallback) #167

Description

@zoza1982

Context

run_transfer_effect's pre-scan is time-boxed via tokio::select! { ... () = sleep(SCAN_BUDGET) => None }
(PR #166). The entry-cap path is unit-tested; the time-box branch itself is not — it needs a
slow backend and a full run_transfer_effect harness, so it was deferred.

Proposal

Extract the scan race into a small helper (e.g. scan_with_deadline(src, items, max_entries, budget, cancel, on_scan)) and unit-test it with #[tokio::test(start_paused = true)] + tokio::time::advance,
using a trivial Vfs whose stat/list sleep past the budget. Assert it returns None (and a fast
mock returns the real total). Optionally, an end-to-end test that an abandoned scan still lets the copy
proceed and emit TransferDone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions