diff --git a/testing/jormungandr-scenario-tests/src/node.rs b/testing/jormungandr-scenario-tests/src/node.rs index 41e635cd71..4ab8104def 100644 --- a/testing/jormungandr-scenario-tests/src/node.rs +++ b/testing/jormungandr-scenario-tests/src/node.rs @@ -9,8 +9,8 @@ use chain_impl_mockchain::{ use jormungandr_lib::{ crypto::hash::Hash, interfaces::{ - EnclaveLeaderId, FragmentLog, Log, LogEntry, LogOutput, NodeState, NodeStatsDto, - PeerRecord, PeerStats, + EnclaveLeaderId, FragmentLog, LeadershipLog, Log, LogEntry, LogOutput, NodeState, + NodeStatsDto, PeerRecord, PeerStats, }, }; pub use jormungandr_testing_utils::testing::{ @@ -391,6 +391,15 @@ impl NodeController { .log_info(format!("node stats ({:?})", self.stats())); } + pub fn leadership_log(&self) -> Result> { + Ok(self.rest_client.leaders_log()?) + } + + pub fn log_leadership_log(&self) { + self.progress_bar + .log_info(format!("{:?}", self.leadership_log().unwrap())); + } + pub fn wait_for_bootstrap(&self) -> Result<()> { let max_try = 20; let sleep = Duration::from_secs(8); diff --git a/testing/jormungandr-testing-utils/src/testing/node/legacy/rest.rs b/testing/jormungandr-testing-utils/src/testing/node/legacy/rest.rs index bcb34decfd..69126d1ebe 100644 --- a/testing/jormungandr-testing-utils/src/testing/node/legacy/rest.rs +++ b/testing/jormungandr-testing-utils/src/testing/node/legacy/rest.rs @@ -189,6 +189,10 @@ impl BackwardCompatibleRest { self.get("network/p2p/view")?.text() } + pub fn leaders_log(&self) -> Result { + self.get("leaders/logs")?.text() + } + pub fn tip(&self) -> Result { let tip = self.get("tip")?.text()?; tip.parse().map_err(RestError::HashParseError) diff --git a/testing/jormungandr-testing-utils/src/testing/node/rest.rs b/testing/jormungandr-testing-utils/src/testing/node/rest.rs index d0bd050c86..c34d6c4683 100644 --- a/testing/jormungandr-testing-utils/src/testing/node/rest.rs +++ b/testing/jormungandr-testing-utils/src/testing/node/rest.rs @@ -9,7 +9,7 @@ use jormungandr_lib::{ crypto::hash::Hash, interfaces::{ AccountState, EnclaveLeaderId, EpochRewardsInfo, FragmentLog, NodeStatsDto, PeerRecord, - PeerStats, StakeDistributionDto, VotePlanStatus, + PeerStats, StakeDistributionDto, VotePlanStatus, LeadershipLog, }, }; use legacy::Settings; @@ -154,6 +154,10 @@ impl JormungandrRest { self.inner.fragment_logs() } + pub fn leaders_log(&self) -> Result, RestError> { + serde_json::from_str(&self.inner.leaders_log()?).map_err(RestError::CannotDeserialize) + } + pub fn leaders(&self) -> Result, RestError> { let leaders = self.inner.leaders()?; let leaders: Vec = if leaders.is_empty() {