mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Allow test_harness to load validators from file
Also adds a command to test_harness binary to generate validators
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::test_case::TestCase;
|
||||
use clap::ArgMatches;
|
||||
use std::path::Path;
|
||||
use std::{fs::File, io::prelude::*};
|
||||
use yaml_rust::YamlLoader;
|
||||
|
||||
@@ -15,6 +16,10 @@ pub fn run_test(matches: &ArgMatches) {
|
||||
};
|
||||
|
||||
for doc in &docs {
|
||||
let validators_dir = matches
|
||||
.value_of("validators_dir")
|
||||
.and_then(|dir_str| Some(Path::new(dir_str)));
|
||||
|
||||
// For each `test_cases` YAML in the document, build a `TestCase`, execute it and
|
||||
// assert that the execution result matches the test_case description.
|
||||
//
|
||||
@@ -29,7 +34,7 @@ pub fn run_test(matches: &ArgMatches) {
|
||||
// panics with a message.
|
||||
for test_case in doc["test_cases"].as_vec().unwrap() {
|
||||
let test_case = TestCase::from_yaml(test_case);
|
||||
test_case.assert_result_valid(test_case.execute())
|
||||
test_case.assert_result_valid(test_case.execute(validators_dir))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user