Skip to content

Commit

Permalink
TestManager: Show the state for current test
Browse files Browse the repository at this point in the history
In a previous pr, the status was changed to show the outcome for each
result row including the current test's row, but if the agent errored,
the state stayed as `inProgress`.
  • Loading branch information
ecpullen committed Dec 19, 2022
1 parent e1df021 commit d4b3a0f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions model/src/test_manager/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ impl From<&Crd> for Vec<ResultRow> {
let state = test.test_user_state().to_string();
let test_results = &test.agent_status().results;
let current_test = &test.agent_status().current_test;
let mut test_iter = test_results.iter().chain(current_test.iter()).peekable();
if test_iter.peek().is_none() {
let mut test_iter = test_results.iter().peekable();
if test_iter.peek().is_none() && current_test.is_none() {
results.push(ResultRow {
name,
object_type: "Test".to_string(),
Expand All @@ -329,6 +329,21 @@ impl From<&Crd> for Vec<ResultRow> {
failed: Some(result.num_failed),
});
}
if let Some(result) = current_test {
let retry_name = if test_results.is_empty() {
name.clone()
} else {
format!("{}-retry-{}", name, test_results.len())
};
results.push(ResultRow {
name: retry_name,
object_type: "Test".to_string(),
state,
passed: Some(result.num_passed),
skipped: Some(result.num_skipped),
failed: Some(result.num_failed),
});
}
}
}
Crd::Resource(resource) => {
Expand Down

0 comments on commit d4b3a0f

Please sign in to comment.