pub struct AsyncFileSystemContractSuite<'a> { /* private fields */ }Expand description
Runs asynchronous provider contracts against one isolated fixture.
§Type Parameters
'a- Lifetime of the borrowed provider fixture.
§Examples
use qubit_fs_testkit::{AsyncFileSystemContractSuite, FileSystemContract};
let fixture = RustdocAsyncFixture::new();
let mut suite = AsyncFileSystemContractSuite::new(&fixture);
poll_support::ready(async {
suite.run_contract(FileSystemContract::Properties).await;
});
assert!(!suite.run().was_interrupted());Implementations§
Source§impl<'a> AsyncFileSystemContractSuite<'a>
impl<'a> AsyncFileSystemContractSuite<'a>
Sourcepub async fn finish(&mut self)
pub async fn finish(&mut self)
Cleans resources created by individually executed asynchronous phases.
The first cleanup attempt closes resource preparation and all run
entry points, even when cleanup fails or this future is cancelled. Call
finish again to retry cleanup; create a fresh fixture and suite for
another run.
§Panics
Panics when a recorded resource cannot be inspected or deleted.
Sourcepub fn capable(&self, capability: FileSystemCapability) -> bool
pub fn capable(&self, capability: FileSystemCapability) -> bool
Sourcepub async fn required_seed(
&mut self,
relative: &str,
bytes: &[u8],
contract: &str,
) -> Path
pub async fn required_seed( &mut self, relative: &str, bytes: &[u8], contract: &str, ) -> Path
Seeds a resource and makes fixture support mandatory for the contract.
§Parameters
relative- Resource name relative to the current contract phase.bytes- Exact content to publish.contract- Contract label used in failure diagnostics.
§Returns
The provider path of the seeded file.
§Panics
Panics when cleanup has started, fixture setup fails, or the required seed hook is unsupported. A failed or cancelled cleanup attempt does not reopen resource preparation.
Source§impl<'a> AsyncFileSystemContractSuite<'a>
impl<'a> AsyncFileSystemContractSuite<'a>
Sourcepub fn new(fixture: &'a dyn AsyncFileSystemFixture) -> Self
pub fn new(fixture: &'a dyn AsyncFileSystemFixture) -> Self
Sourcepub fn report(&self) -> &ContractReport
pub fn report(&self) -> &ContractReport
Returns the report currently accumulated by this suite.
§Returns
The checks recorded so far, including checks that are pending or failed.
Sourcepub const fn run(&self) -> &ContractRun
pub const fn run(&self) -> &ContractRun
Returns retained evidence, including an interrupted execution session.
§Returns
Evidence currently retained by the suite; an interrupted session remains incomplete until cleanup is retried.
Sourcepub async fn run_all(&mut self) -> &ContractRun
pub async fn run_all(&mut self) -> &ContractRun
Executes all phases once and retains evidence across cancellation.
Dropping this future stops I/O and preserves the suite’s cleanup ledger.
Call finish to retry cleanup before dropping the fixture owner.
A run requested after cleanup has started returns a lifecycle failure;
create a fresh fixture and suite for another run.
§Returns
The evidence accumulated so far, including any interrupted execution.
Sourcepub async fn run_contract(
&mut self,
contract: FileSystemContract,
) -> &ContractRun
pub async fn run_contract( &mut self, contract: FileSystemContract, ) -> &ContractRun
Executes one phase once and retains its result in the borrowing suite.
Returns a lifecycle failure without running checks if cleanup has already started. Use a fresh fixture and suite for another run.
§Parameters
contract- Contract phase to execute.
§Returns
Evidence accumulated for the selected phase, including interruption.
Sourcepub async fn run_check(&mut self, id: ContractCheckId) -> &ContractRun
pub async fn run_check(&mut self, id: ContractCheckId) -> &ContractRun
Executes one selected check in a fresh session and retains its cleanup result.
Returns a lifecycle failure without running checks if cleanup has already started. Use a fresh fixture and suite for another run.
§Parameters
id- Identity of the check to execute.
§Returns
Evidence accumulated for the selected check, including interruption.