From 6443f52502a6920e64d37ac04a9dd1630b98ed56 Mon Sep 17 00:00:00 2001 From: Omar Abdulla Date: Mon, 25 Aug 2025 05:06:11 +0300 Subject: [PATCH] Cleanup report model --- crates/report/src/aggregator.rs | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/crates/report/src/aggregator.rs b/crates/report/src/aggregator.rs index 457acd1..bcca409 100644 --- a/crates/report/src/aggregator.rs +++ b/crates/report/src/aggregator.rs @@ -239,7 +239,12 @@ impl ReportAggregator { } fn handle_leader_node_assigned_event(&mut self, event: LeaderNodeAssignedEvent) { - self.test_case_report(&event.test_specifier).leader_node = Some(TestCaseNodeInformation { + let execution_information = self.execution_information(&ExecutionSpecifier { + test_specifier: event.test_specifier, + node_id: event.id, + node_designation: NodeDesignation::Leader, + }); + execution_information.node = Some(TestCaseNodeInformation { id: event.id, platform: event.platform, connection_string: event.connection_string, @@ -247,12 +252,16 @@ impl ReportAggregator { } fn handle_follower_node_assigned_event(&mut self, event: FollowerNodeAssignedEvent) { - self.test_case_report(&event.test_specifier).follower_node = - Some(TestCaseNodeInformation { - id: event.id, - platform: event.platform, - connection_string: event.connection_string, - }); + let execution_information = self.execution_information(&ExecutionSpecifier { + test_specifier: event.test_specifier, + node_id: event.id, + node_designation: NodeDesignation::Follower, + }); + execution_information.node = Some(TestCaseNodeInformation { + id: event.id, + platform: event.platform, + connection_string: event.connection_string, + }); } fn handle_pre_link_contracts_compilation_succeeded_event( @@ -426,12 +435,6 @@ pub struct TestCaseReport { /// Information on the status of the test case and whether it succeeded, failed, or was ignored. #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, - /// Information related to the leader node assigned to this test case. - #[serde(skip_serializing_if = "Option::is_none")] - pub leader_node: Option, - /// Information related to the follower node assigned to this test case. - #[serde(skip_serializing_if = "Option::is_none")] - pub follower_node: Option, /// Information related to the execution on the leader. #[serde(skip_serializing_if = "Option::is_none")] pub leader_execution_information: Option, @@ -479,6 +482,9 @@ pub struct TestCaseNodeInformation { /// Execution information tied to the leader or the follower. #[derive(Clone, Debug, Default, Serialize)] pub struct ExecutionInformation { + /// Information related to the node assigned to this test case. + #[serde(skip_serializing_if = "Option::is_none")] + pub node: Option, /// Information on the pre-link compiled contracts. #[serde(skip_serializing_if = "Option::is_none")] pub pre_link_compilation_status: Option,