Skip to content

Commit

Permalink
replica-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mraszyk committed Oct 20, 2024
1 parent 8c66651 commit 8c84f24
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 708 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rs/pocket_ic_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DEPENDENCIES = [
"//rs/state_machine_tests",
"//rs/types/error_types",
"//rs/types/types",
"@crate_index//:wat",
]

rust_library(
Expand Down
1 change: 1 addition & 0 deletions rs/pocket_ic_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ ic-registry-subnet-type = { path = "../registry/subnet_type" }
ic-state-machine-tests = { path = "../state_machine_tests" }
ic-types = { path = "../types/types" }
pocket-ic = { path = "../../packages/pocket-ic" }
wat = { workspace = true }
20 changes: 20 additions & 0 deletions rs/pocket_ic_tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ impl StateMachine {
self.sm.install_canister(module, payload, settings)
}

pub fn install_canister_wat(
&self,
wat: &str,
payload: Vec<u8>,
settings: Option<CanisterSettingsArgs>,
) -> CanisterId {
self.install_canister(wat::parse_str(wat).expect("invalid WAT"), payload, settings)
.unwrap()
}

pub fn install_existing_canister(
&self,
canister_id: CanisterId,
Expand Down Expand Up @@ -256,6 +266,16 @@ impl StateMachine {
self.install_wasm_in_mode(canister_id, CanisterInstallMode::Upgrade, wasm, payload)
}

pub fn upgrade_canister_wat(&self, canister_id: CanisterId, wat: &str, payload: Vec<u8>) {
self.install_wasm_in_mode(
canister_id,
CanisterInstallMode::Upgrade,
wat::parse_str(wat).expect("invalid WAT"),
payload,
)
.unwrap();
}

pub fn update_settings(
&self,
canister_id: &CanisterId,
Expand Down
2 changes: 1 addition & 1 deletion rs/replica_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DEPENDENCIES = [
"//rs/interfaces/state_manager",
"//rs/monitoring/metrics",
"//rs/monitoring/tracing",
"//rs/pocket_ic_tests",
"//rs/prep",
"//rs/protobuf",
"//rs/registry/fake",
Expand All @@ -25,7 +26,6 @@ DEPENDENCIES = [
"//rs/registry/subnet_type",
"//rs/replica:replica_lib",
"//rs/replicated_state",
"//rs/state_machine_tests",
"//rs/test_utilities",
"//rs/test_utilities/logger",
"//rs/test_utilities/types",
Expand Down
2 changes: 1 addition & 1 deletion rs/replica_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ic-interfaces-registry = { path = "../interfaces/registry" }
ic-interfaces-state-manager = { path = "../interfaces/state_manager" }
ic-management-canister-types = { path = "../types/management_canister_types" }
ic-metrics = { path = "../monitoring/metrics" }
ic-pocket-ic-tests = { path = "../pocket_ic_tests" }
ic-prep = { path = "../prep" }
ic-protobuf = { path = "../protobuf" }
ic-registry-client-fake = { path = "../registry/fake" }
Expand All @@ -31,7 +32,6 @@ ic-registry-provisional-whitelist = { path = "../registry/provisional_whitelist"
ic-registry-subnet-type = { path = "../registry/subnet_type" }
ic-replica = { path = "../replica" }
ic-replicated-state = { path = "../replicated_state" }
ic-state-machine-tests = { path = "../state_machine_tests" }
ic-test-utilities = { path = "../test_utilities" }
ic-test-utilities-logger = { path = "../test_utilities/logger" }
ic-test-utilities-types = { path = "../test_utilities/types" }
Expand Down
2 changes: 1 addition & 1 deletion rs/replica_tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use ic_management_canister_types::{
ProvisionalCreateCanisterWithCyclesArgs, IC_00,
};
use ic_metrics::MetricsRegistry;
use ic_pocket_ic_tests::StateMachine;
use ic_prep_lib::{
internet_computer::{IcConfig, TopologyConfig},
node::{NodeConfiguration, NodeIndex, NodeSecretKeyStore},
Expand All @@ -26,7 +27,6 @@ use ic_registry_provisional_whitelist::ProvisionalWhitelist;
use ic_registry_subnet_type::SubnetType;
use ic_replica::setup::setup_crypto_provider;
use ic_replicated_state::{CanisterState, ReplicatedState};
use ic_state_machine_tests::StateMachine;
use ic_test_utilities::universal_canister::UNIVERSAL_CANISTER_WASM;
use ic_test_utilities_logger::with_test_replica_logger;
use ic_test_utilities_types::{
Expand Down
Loading

0 comments on commit 8c84f24

Please sign in to comment.