Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ num-bigint = "0.4"
# `pocket-ic` should be pinned to an exact version so that the PocketIC server binary version
# `POCKET_IC_SERVER_VERSION` defined in `scripts/run-integration-tests.sh` is compatible:
# https://docs.google.com/document/d/1VYmHUTjrgbzRHtsAyRrI5cj-gWGs7ktTnutPvUMJioU/edit
pocket-ic = "=9.0.2"
pocket-ic = "=10.0.0"
proc-macro2 = "1.0"
prometheus = "0.13.3"
quote = "1.0"
Expand Down
5 changes: 1 addition & 4 deletions scripts/run-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eEuo pipefail

POCKET_IC_SERVER_VERSION="9.0.3"
POCKET_IC_SERVER_VERSION="10.0.0"

SCRIPT=$(readlink -f "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")
Expand Down Expand Up @@ -41,9 +41,6 @@ echo "PocketIC download completed"
cd ../..

if [ $DOWNLOAD_NNS_CANISTERS == "true" ]; then
./scripts/download-nns-canister-wasm.sh icp_ledger ledger-canister
./scripts/download-nns-canister-wasm.sh icp_index ic-icp-index-canister
./scripts/download-nns-canister-wasm.sh cmc cycles-minting-canister
./scripts/download-nns-canister-wasm.sh icrc1_ledger ic-icrc1-ledger
fi

Expand Down
Binary file modified tests/integration/assets/upgrader-memory-v1.bin
Binary file not shown.
9 changes: 4 additions & 5 deletions tests/integration/src/account_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::time::Duration;

use crate::interfaces::mint_icp;
use crate::interfaces::get_icp;
use crate::setup::{setup_new_env, WALLET_ADMIN_USER};
use crate::utils::{create_account, expect_await_call_result, get_icp_asset};
use crate::TestEnv;
Expand All @@ -18,8 +18,7 @@ fn test_fetch_balances() {
let TestEnv {
env,
canister_ids,
// controller,
minter,
controller,
..
} = setup_new_env();

Expand Down Expand Up @@ -62,8 +61,8 @@ fn test_fetch_balances() {
)
.expect("cannot parse ICP account identifier");

mint_icp(&env, minter, &icp_account_identifier, 10 * 100_000_000)
.expect("failed to mint ICP to account");
get_icp(&env, controller, &icp_account_identifier, 10 * 100_000_000)
.expect("failed to get ICP to account");

let messages_ids = [
env.submit_call(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/src/cycles_monitor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ fn successful_monitors_stations_and_tops_up() {
}

#[test]
fn can_mint_cycles_to_top_up_self() {
fn can_get_cycles_to_top_up_self() {
let TestEnv {
env,
canister_ids,
Expand Down
27 changes: 3 additions & 24 deletions tests/integration/src/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,9 @@ use ic_ledger_types::{
DEFAULT_SUBACCOUNT,
};
use pocket_ic::{query_candid_as, update_candid_as, PocketIc};
use std::collections::{HashMap, HashSet};

use crate::setup::{create_canister_with_cycles, get_canister_wasm};

#[derive(CandidType)]
pub enum NnsLedgerCanisterPayload {
Init(NnsLedgerCanisterInitPayload),
}

#[derive(CandidType)]
pub struct NnsLedgerCanisterInitPayload {
pub minting_account: String,
pub initial_values: HashMap<String, Tokens>,
pub send_whitelist: HashSet<Principal>,
pub transfer_fee: Option<Tokens>,
pub token_symbol: Option<String>,
pub token_name: Option<String>,
}

#[derive(CandidType)]
pub struct NnsIndexCanisterInitPayload {
pub ledger_id: Principal,
}

pub fn get_icp_balance(env: &PocketIc, user_id: Principal) -> u64 {
let ledger_canister_id = Principal::from_text("ryjl3-tyaaa-aaaaa-aaaba-cai").unwrap();
let account = AccountIdentifier::new(&user_id, &DEFAULT_SUBACCOUNT);
Expand Down Expand Up @@ -106,13 +85,13 @@ pub fn send_icp(
send_icp_to_account(env, sender_id, to, e8s, memo, None, None)
}

pub fn mint_icp(
pub fn get_icp(
env: &PocketIc,
minter_id: Principal,
rich_id: Principal,
to: &AccountIdentifier,
e8s: u64,
) -> Result<u64, TransferError> {
send_icp_to_account(env, minter_id, *to, e8s, 0, None, Some(0))
send_icp_to_account(env, rich_id, *to, e8s, 0, None, None)
}

#[derive(CandidType)]
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ pub struct TestEnv {
pub env: PocketIc,
pub canister_ids: CanisterIds,
pub controller: Principal,
pub minter: Principal,
}

#[derive(Clone, Copy, Debug)]
pub struct CanisterIds {
pub icp_ledger: Principal,
pub icp_index: Principal,
pub cycles_minting_canister: Principal,
pub control_panel: Principal,
pub station: Principal,
}
Loading
Loading