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 calls;
35mod diagnostics;
36mod errors;
37mod lifecycle;
38mod snapshot;
39mod standalone;
40mod standalone_recipe;
41mod startup;
42mod time;
43mod transport;
44#[cfg(feature = "wire")]
45mod wire;
46
47pub use baseline::CachedPocketIcBaseline;
48pub use baseline_pool::{
49    BaselinePoolContractError, BaselinePoolDisposition, BaselinePoolError, BaselinePoolOutcome,
50    BaselinePoolPreparationError, BaselinePoolTimings, BaselinePreparationStage,
51    CachedPocketIcBaselinePool, CachedPocketIcBaselinePoolGuard, ExtraCanisterPolicy,
52    FailureDisposition, PocketIcBaselineRecipe, PreparedBaseline, RebuildReason, ResetDomainKind,
53    ResetPolicies, ResetReceipt, ResetRequirements, StateResetPolicy, TimeResetPolicy,
54};
55pub use calls::{query_candid_args, update_candid_args};
56pub use diagnostics::{
57    CanisterDiagnosticLogRecord, CanisterDiagnosticLogs, CanisterDiagnosticsBatchContractError,
58    CanisterDiagnosticsBatchEntry, CanisterDiagnosticsBatchReport, CanisterDiagnosticsReport,
59    CanisterDiagnosticsRequest, CanisterLogRenderLimits, DEFAULT_CANISTER_LOG_BYTE_LIMIT,
60    DEFAULT_CANISTER_LOG_RECORD_LIMIT, LabeledCanisterDiagnosticsRequest, PocketIcDiagnosticsExt,
61};
62pub use errors::{
63    CandidCallContext, CandidCallError, CanisterInstallError, StandaloneCanisterInstallError,
64};
65pub use lifecycle::{CanisterInstallExt, InstallSpec, RetryPolicy};
66pub use snapshot::{
67    CanisterSnapshotTarget, ControllerSnapshotError, ControllerSnapshots, PocketIcSnapshotExt,
68    SnapshotCleanupFailure, SnapshotRestoreFunding,
69};
70pub use standalone::StandaloneCanisterFixture;
71pub use standalone_recipe::StandaloneCanisterRecipe;
72pub use startup::{
73    PocketIcInstance, PocketIcManagedServer, PocketIcManagedServerOutput, PocketIcStartupConfig,
74    PocketIcStartupError, PocketIcStartupFailure,
75};
76pub use time::{TickUntilError, advance_and_tick, tick_until};
77pub use transport::{
78    PocketIcCallFailure, PocketIcOperationError, is_dead_pocket_ic_transport_error,
79    try_pocket_ic_operation,
80};
81#[cfg(feature = "wire")]
82pub use wire::{WireCallContext, WireCallError, query_wire, update_wire};
83
84/// All PocketIC extension traits, and no data types.
85///
86/// Importing this module keeps policy/data types explicit while avoiding
87/// repeated trait lists across a large integration-test crate.
88pub mod prelude {
89    pub use super::{CanisterInstallExt, PocketIcDiagnosticsExt, PocketIcSnapshotExt};
90}