Skip to main content

ic_testkit/pic/
mod.rs

1//! Direct PocketIC types plus value-adding host-test harness extensions.
2//!
3//! Platform's explicit client surface 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 installation, diagnostics and snapshots.
9//! Import the call functions, startup configuration and polling helpers explicitly.
10//! Native 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 ic_platform::pocket_ic::{
19    CanisterStatusResult, ErrorCode, LATEST_SERVER_VERSION, PocketIc, PocketIcBuilder, RejectCode,
20    RejectResponse,
21};
22
23#[cfg(feature = "reply-fixtures")]
24pub mod fixtures;
25
26mod server;
27pub use server::{POCKET_IC_SERVER_VERSION, supports_pocket_ic_server};
28#[cfg(unix)]
29pub mod server_assets;
30
31mod baseline;
32mod baseline_pool;
33mod bounded_pool;
34mod diagnostics;
35mod errors;
36mod lifecycle;
37mod snapshot;
38mod standalone;
39mod standalone_recipe;
40mod startup;
41mod time;
42mod transport;
43#[cfg(feature = "wire")]
44mod wire;
45
46pub use baseline::CachedPocketIcBaseline;
47pub use baseline_pool::{
48    BaselinePoolContractError, BaselinePoolDisposition, BaselinePoolError, BaselinePoolOutcome,
49    BaselinePoolPreparationError, BaselinePoolTimings, BaselinePreparationStage,
50    CachedPocketIcBaselinePool, CachedPocketIcBaselinePoolGuard, ExtraCanisterPolicy,
51    FailureDisposition, PocketIcBaselineRecipe, PreparedBaseline, RebuildReason, ResetDomainKind,
52    ResetPolicies, ResetReceipt, ResetRequirements, StateResetPolicy, TimeResetPolicy,
53};
54pub use diagnostics::{
55    CanisterDiagnosticLogRecord, CanisterDiagnosticLogs, CanisterDiagnosticsBatchContractError,
56    CanisterDiagnosticsBatchEntry, CanisterDiagnosticsBatchReport, CanisterDiagnosticsReport,
57    CanisterDiagnosticsRequest, CanisterLogRenderLimits, DEFAULT_CANISTER_LOG_BYTE_LIMIT,
58    DEFAULT_CANISTER_LOG_RECORD_LIMIT, LabeledCanisterDiagnosticsRequest, PocketIcDiagnosticsExt,
59};
60pub use errors::{CanisterInstallError, StandaloneCanisterInstallError};
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    try_pocket_ic_operation,
76};
77#[cfg(feature = "wire")]
78pub use wire::{WireCallContext, WireCallError, query_wire, update_wire};
79
80/// All PocketIC extension traits, and no data types.
81///
82/// Importing this module keeps policy/data types explicit while avoiding
83/// repeated trait lists across a large integration-test crate.
84pub mod prelude {
85    pub use super::{CanisterInstallExt, PocketIcDiagnosticsExt, PocketIcSnapshotExt};
86}