feat: capture specimen logs
This commit is contained in:
parent
86c63f75ab
commit
639527744b
5 changed files with 44 additions and 22 deletions
|
@ -108,12 +108,13 @@ async fn main() -> std::io::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::runner::suite::SuiteRunnerState::run_proxy(ctx.as_ref());
|
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;
|
crate::runner::target::run_target(ctx.as_ref(), path.clone()).await;
|
||||||
let content = crate::runner::results::ArchivableResult {
|
let content = crate::runner::results::ArchivableResult {
|
||||||
commit: "".into(),
|
commit: "".into(),
|
||||||
suites: suite_results,
|
suites: suite_results,
|
||||||
init_containers,
|
init_containers,
|
||||||
|
specimen_logs,
|
||||||
};
|
};
|
||||||
let results_file = path.join("results.json");
|
let results_file = path.join("results.json");
|
||||||
println!("Writing results to: {:?}", path.canonicalize());
|
println!("Writing results to: {:?}", path.canonicalize());
|
||||||
|
|
|
@ -23,12 +23,13 @@ pub async fn run(ctx: AppFullCtx, commit: &str) {
|
||||||
Git::checkout_commit(commit, &control);
|
Git::checkout_commit(commit, &control);
|
||||||
|
|
||||||
for entry in crate::runner::target::get_targets(&control).iter() {
|
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;
|
crate::runner::target::run_target(ctx.as_ref(), entry.into()).await;
|
||||||
let content = ArchivableResult {
|
let content = ArchivableResult {
|
||||||
commit: commit.to_string(),
|
commit: commit.to_string(),
|
||||||
suites: suite_results,
|
suites: suite_results,
|
||||||
init_containers,
|
init_containers,
|
||||||
|
specimen_logs : target_logs,
|
||||||
};
|
};
|
||||||
|
|
||||||
let results_repo = base_dir.join("results");
|
let results_repo = base_dir.join("results");
|
||||||
|
|
|
@ -54,6 +54,7 @@ pub struct ArchivableResult {
|
||||||
pub commit: String,
|
pub commit: String,
|
||||||
pub suites: Vec<ArchivableSuiteResult>,
|
pub suites: Vec<ArchivableSuiteResult>,
|
||||||
pub init_containers: Option<Vec<ArchivableInitResult>>,
|
pub init_containers: Option<Vec<ArchivableInitResult>>,
|
||||||
|
pub specimen_logs: Vec<ArchivableContainer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
|
||||||
|
|
|
@ -21,10 +21,11 @@ pub async fn run_target(
|
||||||
) -> (
|
) -> (
|
||||||
Vec<ArchivableSuiteResult>,
|
Vec<ArchivableSuiteResult>,
|
||||||
Option<Vec<ArchivableInitResult>>,
|
Option<Vec<ArchivableInitResult>>,
|
||||||
|
Vec<ArchivableContainer>,
|
||||||
) {
|
) {
|
||||||
let compose = DockerCompose::new(target.canonicalize().unwrap(), ctx.docker_().clone());
|
let compose = DockerCompose::new(target.canonicalize().unwrap(), ctx.docker_().clone());
|
||||||
compose.up();
|
compose.up();
|
||||||
let services = compose.services();
|
let mut services = compose.services();
|
||||||
|
|
||||||
// Read test suite
|
// Read test suite
|
||||||
let ftest_path = target.join(FTEST_TARGET_FILE);
|
let ftest_path = target.join(FTEST_TARGET_FILE);
|
||||||
|
@ -43,13 +44,17 @@ pub async fn run_target(
|
||||||
|
|
||||||
// shut down target instance
|
// shut down target instance
|
||||||
let mut target_logs = Vec::with_capacity(services.len());
|
let mut target_logs = Vec::with_capacity(services.len());
|
||||||
for s in services.iter() {
|
for s in services.drain(0..) {
|
||||||
target_logs.push(compose.logs(&s.service));
|
let logs = compose.logs(&s.service);
|
||||||
|
target_logs.push(ArchivableContainer {
|
||||||
|
logs,
|
||||||
|
name: s.service,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
compose.down(true, true);
|
compose.down(true, true);
|
||||||
|
|
||||||
(suite_results, init_containers)
|
(suite_results, init_containers, target_logs)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_targets(control: &Path) -> Vec<PathBuf> {
|
pub fn get_targets(control: &Path) -> Vec<PathBuf> {
|
||||||
|
|
|
@ -33,23 +33,37 @@
|
||||||
<h2>Initialization Workflow</h2>
|
<h2>Initialization Workflow</h2>
|
||||||
|
|
||||||
{% for init in payload.results.init_containers %}
|
{% for init in payload.results.init_containers %}
|
||||||
|
<details>
|
||||||
<details>
|
{% if init.success %}
|
||||||
{% if init.success %}
|
<summary>
|
||||||
<summary>
|
<h3 class="test__name">[OK] {{init.container.name}}</h3>
|
||||||
<h3 class="test__name">[OK] {{init.container.name}}</h3>
|
</summary>
|
||||||
</summary>
|
{% else %}
|
||||||
{% else %}
|
<summary>
|
||||||
<summary>
|
<h3 class="test__name">[FAILED] {{init.container.name}}</h3>
|
||||||
<h3 class="test__name">[FAILED] {{init.container.name}}</h3>
|
</summary>
|
||||||
</summary>
|
{% endif %}
|
||||||
{% endif %}
|
<h4>STDOUT</h4>
|
||||||
<h4>STDOUT</h4>
|
<code>{{ init.container.logs.stdout | linebreaksbr }}</code>
|
||||||
<code>{{ init.container.logs.stdout | linebreaksbr }}</code>
|
<h4>STDERR</h4>
|
||||||
<h4>STDERR</h4>
|
<code>{{ init.container.logs.stderr | linebreaksbr }}</code>
|
||||||
<code>{{ init.container.logs.stderr | linebreaksbr }}</code>
|
</details>
|
||||||
</details>
|
|
||||||
{% endfor %} {% endif %}
|
{% endfor %} {% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Specimen Logs</h2>
|
||||||
|
{% for specimen in payload.results.specimen_logs %}
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h3 class="test__name">{{specimen.name}}</h3>
|
||||||
|
</summary>
|
||||||
|
<h4>STDOUT</h4>
|
||||||
|
<code>{{ specimen.logs.stdout | linebreaksbr }}</code>
|
||||||
|
<h4>STDERR</h4>
|
||||||
|
<code>{{ specimen.logs.stderr | linebreaksbr }}</code>
|
||||||
|
</details>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
<style>
|
<style>
|
||||||
.test__name {
|
.test__name {
|
||||||
|
|
Loading…
Add table
Reference in a new issue