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. 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. On Unix, `server_assets` owns explicit
15//! authenticated provisioning and admission; the published
16//! `ic-testkit-server setup` / `check` commands delegate to that implementation.
17
18pub use pocket_ic::{
19    CanisterStatusResult, ErrorCode, LATEST_SERVER_VERSION, PocketIc, PocketIcBuilder, RejectCode,
20    RejectResponse,
21};
22
23mod server;
24pub use server::{POCKET_IC_SERVER_VERSION, supports_pocket_ic_server};
25#[cfg(unix)]
26pub mod server_assets;
27
28mod baseline;
29mod baseline_pool;
30mod bounded_pool;
31mod calls;
32mod diagnostics;
33mod errors;
34mod lifecycle;
35mod snapshot;
36mod standalone;
37mod standalone_recipe;
38mod startup;
39mod time;
40mod transport;
41
42pub use baseline::CachedPocketIcBaseline;
43pub use baseline_pool::{
44    BaselinePoolContractError, BaselinePoolDisposition, BaselinePoolError, BaselinePoolOutcome,
45    BaselinePoolPreparationError, BaselinePoolTimings, BaselinePreparationStage,
46    CachedPocketIcBaselinePool, CachedPocketIcBaselinePoolGuard, CanisterRestoreReceipt,
47    CycleResetPolicy, ExtraCanisterPolicy, FailureDisposition, FixtureRecipeId,
48    PocketIcBaselineRecipe, PreparedBaseline, RebuildReason, ResetDomainKind, ResetDomainPolicy,
49    ResetReceipt, ResetRequirements, StateResetPolicy, TimeResetPolicy,
50};
51pub use calls::{CandidCallExt, query_candid_args, update_candid_args};
52pub use diagnostics::{
53    CanisterDiagnosticLogRecord, CanisterDiagnosticLogs, CanisterDiagnosticsBatchContractError,
54    CanisterDiagnosticsBatchEntry, CanisterDiagnosticsBatchReport, CanisterDiagnosticsReport,
55    CanisterDiagnosticsRequest, CanisterLogRenderLimits, DEFAULT_CANISTER_LOG_BYTE_LIMIT,
56    DEFAULT_CANISTER_LOG_RECORD_LIMIT, LabeledCanisterDiagnosticsRequest, PocketIcDiagnosticsExt,
57};
58pub use errors::{
59    CandidCallContext, CandidCallError, CanisterInstallError, StandaloneCanisterInstallError,
60};
61pub use lifecycle::{CanisterInstallExt, InstallSpec, RetryPolicy};
62pub use snapshot::{
63    CanisterSnapshotTarget, ControllerSnapshotError, ControllerSnapshots, PocketIcSnapshotExt,
64    SnapshotCleanupFailure, SnapshotRestoreFunding,
65};
66pub use standalone::StandaloneCanisterFixture;
67pub use standalone_recipe::StandaloneCanisterRecipe;
68pub use startup::{
69    PocketIcInstance, PocketIcManagedServer, PocketIcManagedServerOutput, PocketIcStartupConfig,
70    PocketIcStartupError, PocketIcStartupFailure,
71};
72pub use time::{TickUntilError, advance_and_tick, tick_until};
73pub use transport::{
74    PocketIcCallFailure, PocketIcOperationError, is_dead_pocket_ic_transport_error,
75};
76
77/// All PocketIC extension traits, and no data types.
78///
79/// Importing this module keeps policy/data types explicit while avoiding
80/// repeated trait lists across a large integration-test crate.
81pub mod prelude {
82    pub use super::{
83        CandidCallExt, CanisterInstallExt, PocketIcDiagnosticsExt, PocketIcSnapshotExt,
84    };
85}