diff --git a/v2/robotmk/src/bin/scheduler/results.rs b/v2/robotmk/src/bin/scheduler/results.rs index 91528411..16c5ec92 100644 --- a/v2/robotmk/src/bin/scheduler/results.rs +++ b/v2/robotmk/src/bin/scheduler/results.rs @@ -116,6 +116,7 @@ pub enum ExecutionReport { pub struct AttemptsOutcome { pub attempts: Vec, pub rebot: Option, + pub config: AttemptsConfig, } #[derive(Serialize)] @@ -138,4 +139,12 @@ pub enum RebotOutcome { pub struct RebotResult { pub xml: String, pub html_base64: String, + pub timestamp: i64, +} + +#[derive(Serialize)] +pub struct AttemptsConfig { + pub interval: u32, + pub timeout: u64, + pub n_attempts_max: usize, } diff --git a/v2/robotmk/src/bin/scheduler/rf/rebot.rs b/v2/robotmk/src/bin/scheduler/rf/rebot.rs index c8e74098..7003fe6d 100644 --- a/v2/robotmk/src/bin/scheduler/rf/rebot.rs +++ b/v2/robotmk/src/bin/scheduler/rf/rebot.rs @@ -6,6 +6,7 @@ use crate::results::{RebotOutcome, RebotResult}; use anyhow::{Context, Result}; use base64::{engine::general_purpose, Engine}; use camino::{Utf8Path, Utf8PathBuf}; +use chrono::Utc; use log::debug; use log::error; use std::fs::{read, read_to_string}; @@ -20,13 +21,14 @@ pub struct Rebot<'a> { impl Rebot<'_> { pub fn rebot(&self) -> RebotOutcome { + let timestamp = Utc::now().timestamp(); match self.run() { Ok(output) => match output.status.code() { Some(exit_code) => match self.environment.create_result_code(exit_code) { - ResultCode::AllTestsPassed => self.process_successful_run(), + ResultCode::AllTestsPassed => self.process_successful_run(timestamp), ResultCode::RobotCommandFailed => { if self.path_xml.exists() { - self.process_successful_run() + self.process_successful_run(timestamp) } else { Self::process_failure(&output, "Rebot run failed (no merged XML found)") } @@ -67,12 +69,13 @@ impl Rebot<'_> { rebot_command_spec } - fn process_successful_run(&self) -> RebotOutcome { + fn process_successful_run(&self, timestamp: i64) -> RebotOutcome { match read_to_string(self.path_xml) { Ok(merged_xml) => match read(self.path_html) { Ok(merged_html) => RebotOutcome::Ok(RebotResult { xml: merged_xml, html_base64: general_purpose::STANDARD.encode(merged_html), + timestamp, }), Err(error) => { let error_message = format!( diff --git a/v2/robotmk/src/bin/scheduler/scheduling/suites.rs b/v2/robotmk/src/bin/scheduler/scheduling/suites.rs index 2c263a32..0dd6b27c 100644 --- a/v2/robotmk/src/bin/scheduler/scheduling/suites.rs +++ b/v2/robotmk/src/bin/scheduler/scheduling/suites.rs @@ -1,6 +1,8 @@ use crate::environment::ResultCode; use crate::internal_config::Suite; -use crate::results::{AttemptOutcome, AttemptsOutcome, ExecutionReport, SuiteExecutionReport}; +use crate::results::{ + AttemptOutcome, AttemptsConfig, AttemptsOutcome, ExecutionReport, SuiteExecutionReport, +}; use crate::rf::{rebot::Rebot, robot::Attempt}; use crate::sessions::session::{RunOutcome, RunSpec}; @@ -92,6 +94,11 @@ fn produce_suite_results(suite: &Suite) -> Result { .rebot(), ) }, + config: AttemptsConfig { + interval: suite.execution_interval_seconds, + timeout: suite.timeout, + n_attempts_max: suite.robot.n_attempts_max, + }, }) }