diff --git a/src/main.rs b/src/main.rs index c6c639b..cd68659 100644 --- a/src/main.rs +++ b/src/main.rs @@ -108,12 +108,13 @@ async fn main() -> std::io::Result<()> { } crate::runner::suite::SuiteRunnerState::run_proxy(ctx.as_ref()); - let (suite_results, init_containers) = + let (suite_results, init_containers, specimen_logs) = crate::runner::target::run_target(ctx.as_ref(), path.clone()).await; let content = crate::runner::results::ArchivableResult { commit: "".into(), suites: suite_results, init_containers, + specimen_logs, }; let results_file = path.join("results.json"); println!("Writing results to: {:?}", path.canonicalize()); diff --git a/src/runner/mod.rs b/src/runner/mod.rs index 50850e6..ce5e150 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -23,12 +23,13 @@ pub async fn run(ctx: AppFullCtx, commit: &str) { Git::checkout_commit(commit, &control); for entry in crate::runner::target::get_targets(&control).iter() { - let (suite_results, init_containers) = + let (suite_results, init_containers, target_logs) = crate::runner::target::run_target(ctx.as_ref(), entry.into()).await; let content = ArchivableResult { commit: commit.to_string(), suites: suite_results, init_containers, + specimen_logs : target_logs, }; let results_repo = base_dir.join("results"); diff --git a/src/runner/results.rs b/src/runner/results.rs index a2c65b2..9ae1be5 100644 --- a/src/runner/results.rs +++ b/src/runner/results.rs @@ -54,6 +54,7 @@ pub struct ArchivableResult { pub commit: String, pub suites: Vec, pub init_containers: Option>, + pub specimen_logs: Vec, } #[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] diff --git a/src/runner/target.rs b/src/runner/target.rs index 32a70cf..39a4de4 100644 --- a/src/runner/target.rs +++ b/src/runner/target.rs @@ -21,10 +21,11 @@ pub async fn run_target( ) -> ( Vec, Option>, + Vec, ) { let compose = DockerCompose::new(target.canonicalize().unwrap(), ctx.docker_().clone()); compose.up(); - let services = compose.services(); + let mut services = compose.services(); // Read test suite let ftest_path = target.join(FTEST_TARGET_FILE); @@ -43,13 +44,17 @@ pub async fn run_target( // shut down target instance let mut target_logs = Vec::with_capacity(services.len()); - for s in services.iter() { - target_logs.push(compose.logs(&s.service)); + for s in services.drain(0..) { + let logs = compose.logs(&s.service); + target_logs.push(ArchivableContainer { + logs, + name: s.service, + }); } compose.down(true, true); - (suite_results, init_containers) + (suite_results, init_containers, target_logs) } pub fn get_targets(control: &Path) -> Vec { diff --git a/templates/index.html b/templates/index.html index 5f513e8..90679b1 100644 --- a/templates/index.html +++ b/templates/index.html @@ -33,23 +33,37 @@

Initialization Workflow

{% for init in payload.results.init_containers %} - -
- {% if init.success %} - -

[OK] {{init.container.name}}

-
- {% else %} - -

[FAILED] {{init.container.name}}

-
- {% endif %} -

STDOUT

- {{ init.container.logs.stdout | linebreaksbr }} -

STDERR

- {{ init.container.logs.stderr | linebreaksbr }} -
+
+ {% if init.success %} + +

[OK] {{init.container.name}}

+
+ {% else %} + +

[FAILED] {{init.container.name}}

+
+ {% endif %} +

STDOUT

+ {{ init.container.logs.stdout | linebreaksbr }} +

STDERR

+ {{ init.container.logs.stderr | linebreaksbr }} +
{% endfor %} {% endif %} + + +

Specimen Logs

+ {% for specimen in payload.results.specimen_logs %} +
+ +

{{specimen.name}}

+
+

STDOUT

+ {{ specimen.logs.stdout | linebreaksbr }} +

STDERR

+ {{ specimen.logs.stderr | linebreaksbr }} +
+ {% endfor %} +