Skip to content

Commit

Permalink
test/e2e: update assert_success/failure to first consume output
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Jul 28, 2022
1 parent 1167f09 commit 6beb558
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/src/e2e/ledger_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ fn test_genesis_validators() -> Result<()> {
let validator_0_alias = "validator-0";
let validator_1_alias = "validator-1";

let init_genesis_validator_0 = setup::run_cmd(
let mut init_genesis_validator_0 = setup::run_cmd(
Bin::Client,
[
"utils",
Expand Down Expand Up @@ -1580,7 +1580,7 @@ fn test_genesis_validators() -> Result<()> {
.remove(validator_0_alias)
.unwrap();

let init_genesis_validator_1 = setup::run_cmd(
let mut init_genesis_validator_1 = setup::run_cmd(
Bin::Client,
[
"utils",
Expand Down
10 changes: 8 additions & 2 deletions tests/src/e2e/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,20 @@ impl AnomaCmd {
}

/// Assert that the process exited with success
pub fn assert_success(&self) {
pub fn assert_success(&mut self) {
// Make sure that there is no unread output first
let _ = self.exp_eof().unwrap();

let status = self.session.wait().unwrap();
assert_eq!(WaitStatus::Exited(self.session.pid(), 0), status);
}

/// Assert that the process exited with failure
#[allow(dead_code)]
pub fn assert_failure(&self) {
pub fn assert_failure(&mut self) {
// Make sure that there is no unread output first
let _ = self.exp_eof().unwrap();

let status = self.session.wait().unwrap();
assert_ne!(WaitStatus::Exited(self.session.pid(), 0), status);
}
Expand Down

0 comments on commit 6beb558

Please sign in to comment.