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//! No type in this module serializes independent instances or owns PocketIC's
9//! server download/cache policy.
10
11pub use pocket_ic::{
12    CanisterStatusResult, ErrorCode, LATEST_SERVER_VERSION, PocketIc, PocketIcBuilder, RejectCode,
13    RejectResponse,
14};
15
16mod baseline;
17mod baseline_pool;
18mod bounded_pool;
19mod calls;
20mod diagnostics;
21mod errors;
22mod lifecycle;
23mod snapshot;
24mod standalone;
25mod standalone_pool;
26mod startup;
27mod time;
28mod transport;
29
30pub use baseline::{
31    CachedPocketIcBaseline, CachedPocketIcBaselineGuard,
32    restore_or_rebuild_cached_pocket_ic_baseline,
33};
34pub use baseline_pool::{
35    BaselinePoolContractError, BaselinePoolError, BaselinePoolOutcome,
36    BaselinePoolPreparationError, BaselinePoolTimings, BaselinePreparationStage,
37    CachedPocketIcBaselinePool, CachedPocketIcBaselinePoolGuard, CanisterRestoreReceipt,
38    CycleResetPolicy, ExtraCanisterPolicy, FailureDisposition, FixtureRecipeId,
39    PocketIcBaselineRecipe, PreparedBaseline, ReadinessReceipt, RebuildReason, ResetAchievement,
40    ResetDomainKind, ResetReceipt, ResetRequirement, ResetRequirements, StateResetPolicy,
41    TimeResetPolicy, ValidationReceipt,
42};
43pub use calls::CandidCallExt;
44pub use diagnostics::{
45    CanisterDiagnosticFailure, CanisterDiagnosticLogRecord, CanisterDiagnosticLogs,
46    CanisterDiagnosticsReport, CanisterDiagnosticsRequest, CanisterLogRenderLimits,
47    DEFAULT_CANISTER_LOG_BYTE_LIMIT, DEFAULT_CANISTER_LOG_RECORD_LIMIT, PocketIcDiagnosticsExt,
48};
49pub use errors::{
50    CandidCallContext, CandidCallError, CandidCallErrorKind, CanisterInstallError,
51    StandaloneCanisterInstallError,
52};
53pub use lifecycle::{CanisterInstallExt, InstallSpec, RetryPolicy, RetryPolicyError};
54pub use snapshot::{
55    CanisterSnapshotTarget, ControllerSnapshotError, ControllerSnapshots, PocketIcSnapshotExt,
56    SnapshotAttemptFailure, SnapshotCleanupFailure, SnapshotRestoreFunding,
57};
58pub use standalone::StandaloneCanisterFixture;
59pub use standalone_pool::{
60    CachedStandaloneCanisterFixtureGuard, CachedStandaloneCanisterFixturePool,
61    StandaloneFixturePoolError, StandaloneFixturePoolOutcome, StandaloneFixturePoolRebuildReason,
62    StandaloneFixturePoolStage, StandaloneFixturePoolTimings,
63};
64pub use startup::{PocketIcBuilderExt, PocketIcStartupError};
65pub use time::PocketIcTimeExt;
66pub use transport::is_dead_pocket_ic_transport_error;
67
68/// All PocketIC extension traits, and no data types.
69///
70/// Importing this module keeps policy/data types explicit while avoiding
71/// repeated trait lists across a large integration-test crate.
72pub mod prelude {
73    pub use super::{
74        CandidCallExt, CanisterInstallExt, PocketIcBuilderExt, PocketIcDiagnosticsExt,
75        PocketIcSnapshotExt, PocketIcTimeExt,
76    };
77}