Skip to main content

ic_testkit/pic/
mod.rs

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