-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integration_tests: bootstrap all the way to being able to run a basic…
… sine test
- Loading branch information
Showing
18 changed files
with
260 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
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
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,48 @@ | ||
use crate::cli_args::*; | ||
|
||
pub fn view_response(_top_args: &CliArgs, cmd_args: &ViewResponseArgs) { | ||
let env = crate::environment::get_env(); | ||
|
||
if crate::registry::get_test_by_name(&cmd_args.test_name).is_none() { | ||
panic!("{} is not a valid, registered test", cmd_args.test_name); | ||
}; | ||
|
||
let artifacts_dir = env.artifacts_dir_for(&cmd_args.test_name); | ||
if !artifacts_dir.exists() { | ||
panic!( | ||
"{}: no artifacts directory found. Tried {}. This probably means the test passed.", | ||
cmd_args.test_name, | ||
artifacts_dir.display() | ||
); | ||
} | ||
|
||
let possibilities = [ | ||
env.panic_response_file_for(&cmd_args.test_name), | ||
env.good_response_file_for(&cmd_args.test_name), | ||
]; | ||
|
||
let mut response: Option<String> = None; | ||
for p in possibilities { | ||
match std::fs::read(&p) { | ||
Ok(r) => { | ||
response = Some( | ||
String::from_utf8(r).expect("This is a JSON file and should always be UTF-8"), | ||
); | ||
} | ||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => continue, | ||
Err(e) => { | ||
panic!("While trying to open path {}: {}", p.display(), e); | ||
} | ||
} | ||
} | ||
|
||
let response = response.expect( | ||
"Unable to find a response file in the artifacts directory. Manual examination is required", | ||
); | ||
|
||
// Converting to yaml gets us nice pretty printing of multiline strings. | ||
let json: serde_json::Value = serde_json::from_str(&response).unwrap(); | ||
let yaml = serde_yaml::to_string(&json).unwrap(); | ||
println!("Response for {}", cmd_args.test_name); | ||
println!("{yaml}"); | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.