Skip to content

Commit

Permalink
test: Use mainnet binaries for the queues compatibility test (#419)
Browse files Browse the repository at this point in the history
Co-authored-by: Bas van Dijk <[email protected]>
Co-authored-by: Alin Sinpalean <[email protected]>
  • Loading branch information
3 people authored Jul 29, 2024
1 parent 402a3a6 commit 32bc2c2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
1 change: 1 addition & 0 deletions rs/tests/message_routing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ system_test(
target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS
runtime_deps = [
"//rs/replicated_state:replicated_state_test_binary",
"//testnet:mainnet_revisions",
],
deps = DEPENDENCIES + ["//rs/tests"],
)
27 changes: 18 additions & 9 deletions rs/tests/message_routing/queues_compatibility_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! This a WIP upgrade/downgrade test for canister queues. The approach (following
//! This is an upgrade/downgrade test for canister queues. The approach (following
//! the CUP compatibility tests):
//!
//! 1. At each commit to master, we create a binary that can serialize and
Expand All @@ -16,11 +16,7 @@
//! by the other. As the today's special (free of charge), we also check that the
//! current version can deserialize its own stuff.
//!
//! We don't yet download the mainnet release version, since they don't have the
//! required binaries published. We just download some random previous version
//! that does.
//!
//! We also follow he approach from the CUP compatibility tests in that the binary
//! We follow the approach from the CUP compatibility tests in that the binary
//! used is actually the binary produced by the rust_test, and not a separate
//! target. The second step then uses the fact that Rust test binaries can be passed
//! the name of the test as the argument, to perform the
Expand All @@ -35,7 +31,9 @@
//! neither fun nor profitable.
use anyhow::Result;
use serde::Deserialize;
use slog::{info, Logger};
use std::collections::HashMap;
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -187,6 +185,11 @@ impl TestCase {
}
}

#[derive(Deserialize)]
struct Subnets {
subnets: HashMap<String, String>,
}

fn test(env: TestEnv) {
let logger = env.logger();

Expand All @@ -195,9 +198,15 @@ fn test(env: TestEnv) {
"ic/rs/replicated_state/replicated_state_test_binary/replicated_state_test_binary",
"canister_state::queues::tests::mainnet_compatibility_tests::basic_test",
);
// TODO: read this from mainnet_revisions.json once the mainnet releases
// have the fixture binaries published
let mainnet_versions = vec!["38565ef90ef16d47f0d4646903bba61226f36d40".to_string()];

let versions_json = env
.read_dependency_to_string("testnet/mainnet_revisions.json")
.expect("mainnet IC versions");

let parsed: Subnets =
serde_json::from_str(&versions_json).expect("Can't parse the mainnet revisions JSON");
let mainnet_versions: Vec<String> = parsed.subnets.values().cloned().collect();

info!(logger, "Mainnet versions: {:?}", mainnet_versions);

for mainnet_version in mainnet_versions {
Expand Down
5 changes: 5 additions & 0 deletions testnet/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jq_dep(
target = "mainnet_nns_revision.txt",
)

filegroup(
name = "mainnet_revisions",
srcs = ["mainnet_revisions.json"],
)

py_binary(
name = "inventory",
srcs = ["ansible/inventory/inventory.py"],
Expand Down

0 comments on commit 32bc2c2

Please sign in to comment.