Skip to content

Commit da9a9f9

Browse files
apollo_integration_tests: simplify node type verifcation in restart tests (#10506)
1 parent 0464ca7 commit da9a9f9

File tree

3 files changed

+14
-30
lines changed

3 files changed

+14
-30
lines changed

crates/apollo_integration_tests/src/bin/sequencer_node_end_to_end_integration_tests/integration_test_restart_flow.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
use std::time::Duration;
22

3-
use apollo_deployments::deployments::consolidated::ConsolidatedNodeServiceName;
4-
use apollo_deployments::deployments::hybrid::HybridNodeServiceName;
3+
use apollo_deployments::service::NodeType;
54
use apollo_infra_utils::test_utils::TestIdentifier;
65
use apollo_integration_tests::integration_test_manager::{
76
IntegrationTestManager,
87
DEFAULT_SENDER_ACCOUNT,
98
};
109
use apollo_integration_tests::integration_test_utils::integration_test_setup;
11-
use strum::IntoEnumIterator;
1210
use tracing::info;
1311

1412
#[tokio::main]
@@ -38,25 +36,9 @@ async fn main() {
3836
.await;
3937

4038
// Assert that RESTART_NODE is a hybrid node.
41-
assert_eq!(
42-
integration_test_manager
43-
.get_idle_nodes()
44-
.get(&RESTART_NODE)
45-
.unwrap()
46-
.get_executables()
47-
.len(),
48-
HybridNodeServiceName::iter().count()
49-
);
39+
assert_eq!(integration_test_manager.get_node_type(RESTART_NODE), NodeType::Hybrid);
5040
// Assert that SHUTDOWN_NODE is not a consolidated node.
51-
assert_ne!(
52-
integration_test_manager
53-
.get_idle_nodes()
54-
.get(&SHUTDOWN_NODE)
55-
.unwrap()
56-
.get_executables()
57-
.len(),
58-
ConsolidatedNodeServiceName::iter().count()
59-
);
41+
assert_ne!(integration_test_manager.get_node_type(SHUTDOWN_NODE), NodeType::Consolidated);
6042

6143
let mut node_indices = integration_test_manager.get_node_indices();
6244

crates/apollo_integration_tests/src/bin/sequencer_node_end_to_end_integration_tests/integration_test_restart_service_single_node_flow.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::collections::HashMap;
22
use std::time::Duration;
33

44
use apollo_deployments::deployments::hybrid::HybridNodeServiceName;
5+
use apollo_deployments::service::NodeType;
56
use apollo_infra_utils::test_utils::TestIdentifier;
67
use apollo_integration_tests::integration_test_manager::{
78
IntegrationTestManager,
@@ -38,15 +39,7 @@ async fn main() {
3839
.await;
3940

4041
// Assert that RESTART_NODE is a hybrid node.
41-
assert_eq!(
42-
integration_test_manager
43-
.get_idle_nodes()
44-
.get(&RESTART_NODE)
45-
.unwrap()
46-
.get_executables()
47-
.len(),
48-
HybridNodeServiceName::iter().count()
49-
);
42+
assert_eq!(integration_test_manager.get_node_type(RESTART_NODE), NodeType::Hybrid);
5043

5144
let node_indices = integration_test_manager.get_node_indices();
5245
integration_test_manager.run_nodes(node_indices.clone()).await;

crates/apollo_integration_tests/src/integration_test_manager.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,15 @@ impl IntegrationTestManager {
372372
&self.idle_nodes
373373
}
374374

375+
pub fn get_node_type(&self, node_idx: usize) -> NodeType {
376+
let node_setup = self
377+
.idle_nodes
378+
.get(&node_idx)
379+
.or_else(|| self.running_nodes.get(&node_idx).map(|node| &node.node_setup))
380+
.expect("Node {node_idx} does not exist in idle or running nodes.");
381+
node_setup.node_type
382+
}
383+
375384
pub fn tx_generator(&self) -> &MultiAccountTransactionGenerator {
376385
&self.tx_generator
377386
}

0 commit comments

Comments
 (0)