Skip to content

Commit

Permalink
feat(e2e-tests): assert state sync after invite-join
Browse files Browse the repository at this point in the history
  • Loading branch information
fbozic committed Dec 23, 2024
1 parent bb54d55 commit 737ac17
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
8 changes: 8 additions & 0 deletions e2e-tests/config/scenarios/kv-store/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
},
{
"contextInviteJoin": null
},
{
"jsonRpcCall": {
"methodName": "get",
"argsJson": { "key": "foo" },
"expectedResultJson": "bar",
"target": "allMembers"
}
}
]
}
4 changes: 3 additions & 1 deletion e2e-tests/src/meroctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ impl Meroctl {

root_args.extend(args);

let args_str = root_args.join(" ");

self.output_writer
.write_string(format!("Command: '{:}' {:?}", &self.binary, root_args));
.write_string(format!("Command: '{:} {:}'", &self.binary, args_str));

let output = Command::new(&self.binary)
.args(root_args)
Expand Down
7 changes: 4 additions & 3 deletions e2e-tests/src/merod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ impl Merod {

root_args.extend(args);

let log_file = self.log_dir.join(format!("{}.log", log_suffix));
let mut log_file = File::create(&log_file).await?;
let args_str = root_args.join(" ");

self.output_writer
.write_string(format!("Command: '{:}' {:?}", &self.binary, root_args));
.write_string(format!("Command: '{:} {:}'", &self.binary, args_str));

let log_file = self.log_dir.join(format!("{}.log", log_suffix));
let mut log_file = File::create(&log_file).await?;
let mut child = Command::new(&self.binary)
.args(root_args)
.stdout(Stdio::piped())
Expand Down
6 changes: 6 additions & 0 deletions e2e-tests/src/steps/context_invite_join.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use std::time::Duration;

use eyre::{bail, Result as EyreResult};
use serde::{Deserialize, Serialize};
use tokio::time::sleep;

use crate::driver::{Test, TestContext};

Expand Down Expand Up @@ -57,6 +60,9 @@ impl Test for InviteJoinContextStep {
.insert(invitee.clone(), invitee_public_key),
);

// Sync period is 30s, wait a bit longer to make sure the node is synced
sleep(Duration::from_secs(40)).await;

ctx.output_writer
.write_string(format!("Report: Node '{}' joined the context", invitee));
}
Expand Down

0 comments on commit 737ac17

Please sign in to comment.