Skip to content

Commit

Permalink
integration test using blob from fixture to start a diem-node in test…
Browse files Browse the repository at this point in the history
… mode
  • Loading branch information
0o-de-lally committed Feb 13, 2023
1 parent 074636d commit 8ca37d0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 23 deletions.
23 changes: 0 additions & 23 deletions ol/genesis-tools/tests/read_json.depr

This file was deleted.

49 changes: 49 additions & 0 deletions ol/genesis-tools/tests/start_node_from_blob.rs
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()
}

0 comments on commit 8ca37d0

Please sign in to comment.