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, ExtraCanisterPolicy,
47    FailureDisposition, PocketIcBaselineRecipe, PreparedBaseline, RebuildReason, ResetDomainKind,
48    ResetPolicies, ResetReceipt, ResetRequirements, StateResetPolicy, TimeResetPolicy,
49};
50pub use calls::{query_candid_args, update_candid_args};
51pub use diagnostics::{
52    CanisterDiagnosticLogRecord, CanisterDiagnosticLogs, CanisterDiagnosticsBatchContractError,
53    CanisterDiagnosticsBatchEntry, CanisterDiagnosticsBatchReport, CanisterDiagnosticsReport,
54    CanisterDiagnosticsRequest, CanisterLogRenderLimits, DEFAULT_CANISTER_LOG_BYTE_LIMIT,
55    DEFAULT_CANISTER_LOG_RECORD_LIMIT, LabeledCanisterDiagnosticsRequest, PocketIcDiagnosticsExt,
56};
57pub use errors::{
58    CandidCallContext, CandidCallError, CanisterInstallError, StandaloneCanisterInstallError,
59};
60pub use lifecycle::{CanisterInstallExt, InstallSpec, RetryPolicy};
61pub use snapshot::{
62    CanisterSnapshotTarget, ControllerSnapshotError, ControllerSnapshots, PocketIcSnapshotExt,
63    SnapshotCleanupFailure, SnapshotRestoreFunding,
64};
65pub use standalone::StandaloneCanisterFixture;
66pub use standalone_recipe::StandaloneCanisterRecipe;
67pub use startup::{
68    PocketIcInstance, PocketIcManagedServer, PocketIcManagedServerOutput, PocketIcStartupConfig,
69    PocketIcStartupError, PocketIcStartupFailure,
70};
71pub use time::{TickUntilError, advance_and_tick, tick_until};
72pub use transport::{
73    PocketIcCallFailure, PocketIcOperationError, is_dead_pocket_ic_transport_error,
74};
75
76/// All PocketIC extension traits, and no data types.
77///
78/// Importing this module keeps policy/data types explicit while avoiding
79/// repeated trait lists across a large integration-test crate.
80pub mod prelude {
81    pub use super::{CanisterInstallExt, PocketIcDiagnosticsExt, PocketIcSnapshotExt};
82}