forked from 0LNetworkCommunity/libra-legacy-v6
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integration test using blob from fixture to start a diem-node in test…
… mode
- Loading branch information
1 parent
074636d
commit 8ca37d0
Showing
2 changed files
with
49 additions
and
23 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use std::io::BufRead; | ||
use std::io::BufReader; | ||
use std::path::PathBuf; | ||
use std::process::Command; | ||
use std::process::Stdio; | ||
|
||
#[test] | ||
fn start_test_node() { | ||
std::env::set_var("RUST_LOG", "debug"); | ||
let source_path = Path::new(env!("CARGO_MANIFEST_DIR")); | ||
let blob_path = blob_path(); | ||
let mut swarm_cmd = Command::new("cargo"); | ||
swarm_cmd.current_dir(&source_path.as_os_str()); | ||
swarm_cmd | ||
.arg("run") | ||
.arg("-p") | ||
.arg("diem-node") | ||
.arg("--") | ||
.arg("--test") | ||
.arg("--genesis-modules") | ||
.arg(&blob_path.as_os_str()); | ||
let mut cmd = swarm_cmd | ||
.stdout(Stdio::piped()) | ||
.stderr(Stdio::inherit()) // so we see error | ||
.spawn() | ||
.expect("could not start diem-node"); | ||
|
||
let stdout = cmd.stdout.take().expect("no stdout"); | ||
// let mut a = BufReader::new(stdout); | ||
// let line = a | ||
BufReader::new(stdout) | ||
.lines() | ||
.find(|e| { | ||
dbg!(&e); | ||
e.as_ref().unwrap().contains("==== 10") | ||
}); | ||
} | ||
|
||
fn blob_path() -> PathBuf { | ||
use std::path::Path; | ||
let path = env!("CARGO_MANIFEST_DIR"); | ||
Path::new(path) | ||
.parent() | ||
.unwrap() | ||
.parent() | ||
.unwrap() | ||
.join("ol/fixtures/rescue/sample_export_recovery.json") | ||
.to_owned() | ||
} |