Skip to main content

ic_testkit/pic/
mod.rs

1//! Direct PocketIC types plus value-adding host-test harness extensions.
2//!
3//! Construct and own [`PocketIc`] instances normally, then import individual
4//! extension traits or [`prelude`] for Candid calls, installation, diagnostics,
5//! snapshots, fallible startup, and nanosecond time conversion. Native
6//! simulator operations remain upstream inherent methods.
7//!
8//! [`PocketIcManagedServer`] can explicitly own one exact caller-selected
9//! server child for a serial suite. No type serializes independent instances
10//! or owns PocketIC's server download/cache policy.
11
12pub use pocket_ic::{
13    CanisterStatusResult, ErrorCode, LATEST_SERVER_VERSION, PocketIc, PocketIcBuilder, RejectCode,
14    RejectResponse,
15};
16
17mod baseline;
18mod baseline_pool;
19mod bounded_pool;
20mod calls;
21mod diagnostics;
22mod errors;
23mod lifecycle;
24mod snapshot;
25mod standalone;
26mod standalone_pool;
27mod startup;
28mod time;
29mod transport;
30
31pub use baseline::{
32    CachedPocketIcBaseline, CachedPocketIcBaselineGuard,
33    restore_or_rebuild_cached_pocket_ic_baseline,
34};
35pub use baseline_pool::{
36    BaselinePoolContractError, BaselinePoolError, BaselinePoolOutcome,
37    BaselinePoolPreparationError, BaselinePoolTimings, BaselinePreparationStage,
38    CachedPocketIcBaselinePool, CachedPocketIcBaselinePoolGuard, CanisterRestoreReceipt,
39    CycleResetPolicy, ExtraCanisterPolicy, FailureDisposition, FixtureRecipeId,
40    PocketIcBaselineRecipe, PreparedBaseline, ReadinessReceipt, RebuildReason, ResetAchievement,
41    ResetDomainKind, ResetReceipt, ResetRequirement, ResetRequirements, StateResetPolicy,
42    TimeResetPolicy, ValidationReceipt,
43};
44pub use calls::CandidCallExt;
45pub use diagnostics::{
46    CanisterDiagnosticFailure, CanisterDiagnosticLogRecord, CanisterDiagnosticLogs,
47    CanisterDiagnosticsBatchContractError, CanisterDiagnosticsBatchEntry,
48    CanisterDiagnosticsBatchReport, CanisterDiagnosticsReport, CanisterDiagnosticsRequest,
49    CanisterLogRenderLimits, DEFAULT_CANISTER_LOG_BYTE_LIMIT, DEFAULT_CANISTER_LOG_RECORD_LIMIT,
50    LabeledCanisterDiagnosticsRequest, PocketIcDiagnosticsExt,
51};
52pub use errors::{
53    CandidCallContext, CandidCallError, CandidCallErrorKind, CanisterInstallError,
54    StandaloneCanisterInstallError,
55};
56pub use lifecycle::{CanisterInstallExt, InstallSpec, RetryPolicy, RetryPolicyError};
57pub use snapshot::{
58    CanisterSnapshotTarget, ControllerSnapshotError, ControllerSnapshots, PocketIcSnapshotExt,
59    SnapshotAttemptFailure, SnapshotCleanupFailure, SnapshotRestoreFunding,
60};
61pub use standalone::StandaloneCanisterFixture;
62pub use standalone_pool::{
63    CachedStandaloneCanisterFixtureGuard, CachedStandaloneCanisterFixturePool,
64    StandaloneFixturePoolError, StandaloneFixturePoolOutcome, StandaloneFixturePoolRebuildReason,
65    StandaloneFixturePoolStage, StandaloneFixturePoolTimings,
66};
67pub use startup::{
68    PocketIcBuilderExt, PocketIcManagedServer, PocketIcManagedServerOutput, PocketIcStartupConfig,
69    PocketIcStartupError,
70};
71pub use time::PocketIcTimeExt;
72pub use transport::is_dead_pocket_ic_transport_error;
73
74/// All PocketIC extension traits, and no data types.
75///
76/// Importing this module keeps policy/data types explicit while avoiding
77/// repeated trait lists across a large integration-test crate.
78pub mod prelude {
79    pub use super::{
80        CandidCallExt, CanisterInstallExt, PocketIcBuilderExt, PocketIcDiagnosticsExt,
81        PocketIcSnapshotExt, PocketIcTimeExt,
82    };
83}