Skip to content

Commit

Permalink
fix: backwards compatibility tests
Browse files Browse the repository at this point in the history
fix: fix

fix: test

fix: hold

fix: tests fix
  • Loading branch information
Kodylow committed Mar 10, 2024
1 parent fc86785 commit 9b31257
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions devimint/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ pub async fn latency_tests(dev_fed: DevFed, r#type: LatencyTest) -> Result<()> {
}

pub async fn cli_tests(dev_fed: DevFed) -> Result<()> {
let fedimint_cli_version = crate::util::FedimintCli::version_or_default().await;
let version_req = VersionReq::parse(">=0.3.0-alpha")?;
log_binary_versions().await?;
let data_dir = env::var("FM_DATA_DIR")?;

Expand Down Expand Up @@ -410,10 +412,26 @@ pub async fn cli_tests(dev_fed: DevFed) -> Result<()> {

let fed_id = fed.calculate_federation_id().await;
let invite = fed.invite_code()?;
let invite_code = cmd!(client, "dev", "decode-invite-code", invite.clone())
.out_json()
.await?;
anyhow::ensure!(

let invite_code = if version_req.matches(&fedimint_cli_version) {
cmd!(client, "dev", "decode", "invite-code", invite.clone())
} else {
cmd!(client, "dev", "decode-invite-code", invite.clone())
}
.out_json()
.await?;

let encode_invite_output = if version_req.matches(&fedimint_cli_version) {
cmd!(
client,
"dev",
"encode",
"invite-code",
format!("--url={}", invite_code["url"].as_str().unwrap()),
"--federation_id={fed_id}",
"--peer=0"
)
} else {
cmd!(
client,
"dev",
Expand All @@ -422,11 +440,12 @@ pub async fn cli_tests(dev_fed: DevFed) -> Result<()> {
"--federation_id={fed_id}",
"--peer=0"
)
.out_json()
.await?["invite_code"]
.as_str()
.unwrap()
== invite,
}
.out_json()
.await?;

anyhow::ensure!(
encode_invite_output["invite_code"].as_str().unwrap() == invite,
"failed to decode and encode the client invite code",
);

Expand Down

0 comments on commit 9b31257

Please sign in to comment.