Skip to content

Commit

Permalink
Remove AttemptsOutcome
Browse files Browse the repository at this point in the history
This struct has become unnecessary with the dropping of `clokwerk`.
  • Loading branch information
jherbel committed Dec 8, 2023
1 parent 53300ef commit c580fbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
11 changes: 3 additions & 8 deletions v2/robotmk/src/bin/scheduler/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ pub enum EnvironmentBuildStatusError {
#[derive(Serialize)]
pub struct SuiteExecutionReport {
pub suite_id: String,
pub outcome: AttemptsOutcome,
pub attempts: Vec<AttemptOutcome>,
pub rebot: Option<RebotOutcome>,
pub config: AttemptsConfig,
}

impl WritePiggybackSection for SuiteExecutionReport {
Expand All @@ -108,13 +110,6 @@ impl WritePiggybackSection for SuiteExecutionReport {
}
}

#[derive(Serialize)]
pub struct AttemptsOutcome {
pub attempts: Vec<AttemptOutcome>,
pub rebot: Option<RebotOutcome>,
pub config: AttemptsConfig,
}

#[derive(Serialize)]
pub enum AttemptOutcome {
AllTestsPassed,
Expand Down
13 changes: 5 additions & 8 deletions v2/robotmk/src/bin/scheduler/scheduling/suites.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::environment::ResultCode;
use crate::internal_config::Suite;
use crate::results::{AttemptOutcome, AttemptsConfig, AttemptsOutcome, SuiteExecutionReport};
use crate::results::{AttemptOutcome, AttemptsConfig, SuiteExecutionReport};
use crate::rf::{rebot::Rebot, robot::Attempt};
use crate::sessions::session::{RunOutcome, RunSpec};

Expand All @@ -13,11 +13,7 @@ use std::fs::create_dir_all;

pub fn run_suite(suite: &Suite) -> Result<()> {
debug!("Running suite {}", &suite.id);
let report = SuiteExecutionReport {
suite_id: suite.id.clone(),
outcome: produce_suite_results(suite)?,
};
report
produce_suite_results(suite)?
.write(
&suite.results_file,
suite.host.clone(),
Expand All @@ -29,7 +25,7 @@ pub fn run_suite(suite: &Suite) -> Result<()> {
Ok(())
}

fn produce_suite_results(suite: &Suite) -> Result<AttemptsOutcome> {
fn produce_suite_results(suite: &Suite) -> Result<SuiteExecutionReport> {
let output_directory = suite
.working_directory
.join(Utc::now().format("%Y-%m-%dT%H.%M.%S%.f%z").to_string());
Expand All @@ -41,7 +37,8 @@ fn produce_suite_results(suite: &Suite) -> Result<AttemptsOutcome> {

let (attempt_outcomes, output_paths) = run_attempts_until_succesful(suite, &output_directory)?;

Ok(AttemptsOutcome {
Ok(SuiteExecutionReport {
suite_id: suite.id.clone(),
attempts: attempt_outcomes,
rebot: if output_paths.is_empty() {
None
Expand Down

0 comments on commit c580fbd

Please sign in to comment.