Skip to content

Commit

Permalink
Add some integration tests for the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
cndolo committed Feb 13, 2023
1 parent 0200953 commit 7cd3159
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
53 changes: 51 additions & 2 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ mbedtls-sys-auto = { git = "https://github.com/mobilecoinfoundation/rust-mbedtls

# Override lmdb-rkv for a necessary bugfix (see https://github.com/mozilla/lmdb-rs/pull/80)
lmdb-rkv = { git = "https://github.com/mozilla/lmdb-rs", rev = "df1c2f5" }

[dev-dependencies]
assert_cmd = "2.0"
predicates = "2.1.5"
19 changes: 19 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use assert_cmd::Command;
use predicates::prelude::*;

#[test]
fn minimal_args() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("mc-crawler")?;
cmd.assert().success();
Ok(())
}

#[test]
fn invalid_bootstrap_file_passed() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("mc-crawler")?;
cmd.arg("./invalid-file");
cmd.assert()
.failure()
.stderr(predicate::str::contains("Error opening bootstrap file"));
Ok(())
}

0 comments on commit 7cd3159

Please sign in to comment.