Skip to content

Commit 99ca484

Browse files
apollo_integration_tests: remove redundant code
1 parent fc2765d commit 99ca484

File tree

3 files changed

+3
-53
lines changed

3 files changed

+3
-53
lines changed

crates/apollo_integration_tests/src/bin/sequencer_node_setup.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ async fn main() {
3333
)
3434
.await;
3535

36-
// TODO(Tsabary/Nadin): rename dir from "ports" to "config".
37-
// TODO(Tsabary/Nadin): avoid the hard-coded file names, e.g., "node_"
38-
let simulator_config_file = format!("{}/simulator_ports", args.output_base_dir);
39-
info!("Generate simulator ports json files under {:?}", simulator_config_file);
40-
create_dir_all(&simulator_config_file).await.unwrap();
41-
for (node_index, node_setup) in test_manager.get_idle_nodes().iter() {
42-
let path = format!("{}/node_{}", simulator_config_file, node_index);
43-
node_setup.generate_simulator_ports_json(&path);
44-
}
45-
4636
info!("Node setup completed");
4737
}
4838

crates/apollo_integration_tests/src/bin/sequencer_simulator.rs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,6 @@ fn read_ports_from_file(path: &str) -> (u16, u16) {
7676
(http_port, monitoring_port)
7777
}
7878

79-
fn get_ports(args: &Args) -> (u16, u16) {
80-
match (args.http_port, args.monitoring_port) {
81-
(Some(http), Some(monitoring)) => (http, monitoring),
82-
(None, None) => {
83-
if let Some(ref path) = args.simulator_ports_path {
84-
read_ports_from_file(path)
85-
} else {
86-
panic!(
87-
"Either both --http-port and --monitoring-port should be supplied, or a \
88-
--simulator-ports-path should be provided."
89-
);
90-
}
91-
}
92-
_ => panic!(
93-
"Either supply both --http-port and --monitoring-port, or use --simulator-ports-path."
94-
),
95-
}
96-
}
97-
9879
async fn run_simulation(
9980
sequencer_simulator: &SequencerSimulator,
10081
tx_generator: &mut MultiAccountTransactionGenerator,
@@ -169,13 +150,10 @@ struct Args {
169150
monitoring_url: String,
170151

171152
#[arg(long)]
172-
simulator_ports_path: Option<String>,
173-
174-
#[arg(long)]
175-
http_port: Option<u16>,
153+
http_port: u16,
176154

177155
#[arg(long)]
178-
monitoring_port: Option<u16>,
156+
monitoring_port: u16,
179157

180158
#[arg(long, help = "Run the simulator in an infinite loop")]
181159
run_forever: bool,
@@ -204,7 +182,7 @@ async fn main() -> anyhow::Result<()> {
204182

205183
let mut tx_generator = create_integration_test_tx_generator();
206184

207-
let (http_port, monitoring_port) = get_ports(&args);
185+
let (http_port, monitoring_port) = (args.http_port, args.monitoring_port);
208186

209187
let sequencer_simulator =
210188
SequencerSimulator::new(&args.http_url, http_port, &args.monitoring_url, monitoring_port);

crates/apollo_integration_tests/src/integration_test_manager.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::time::Duration;
88
use alloy::node_bindings::AnvilInstance;
99
use apollo_http_server::config::HttpServerConfig;
1010
use apollo_http_server::test_utils::HttpTestClient;
11-
use apollo_infra_utils::dumping::serialize_to_file;
1211
use apollo_infra_utils::test_utils::{AvailablePortsGenerator, TestIdentifier};
1312
use apollo_infra_utils::tracing::{CustomLogger, TraceLevel};
1413
use apollo_l1_gas_price::eth_to_strk_oracle::EthToStrkOracleConfig;
@@ -100,7 +99,6 @@ pub struct NodeSetup {
10099
executables: Vec<ExecutableSetup>,
101100
// TODO(Nadin): remove these index fields once executables is migrated to a map
102101
batcher_index: usize,
103-
http_server_index: usize,
104102
state_sync_index: usize,
105103
consensus_manager_index: usize,
106104

@@ -118,7 +116,6 @@ impl NodeSetup {
118116
pub fn new(
119117
executables: Vec<ExecutableSetup>,
120118
batcher_index: usize,
121-
http_server_index: usize,
122119
state_sync_index: usize,
123120
consensus_manager_index: usize,
124121
add_tx_http_client: HttpTestClient,
@@ -137,14 +134,12 @@ impl NodeSetup {
137134
}
138135

139136
validate_index(batcher_index, len, "Batcher");
140-
validate_index(http_server_index, len, "HTTP server");
141137
validate_index(state_sync_index, len, "State sync");
142138
validate_index(consensus_manager_index, len, "Consensus manager");
143139

144140
Self {
145141
executables,
146142
batcher_index,
147-
http_server_index,
148143
state_sync_index,
149144
consensus_manager_index,
150145
add_tx_http_client,
@@ -185,23 +180,11 @@ impl NodeSetup {
185180
}
186181
}
187182

188-
pub fn generate_simulator_ports_json(&self, path: &str) {
189-
let json_data = serde_json::json!({
190-
HTTP_PORT_ARG: self.executables[self.http_server_index].get_config().http_server_config.as_ref().expect("Should have http server config").port,
191-
MONITORING_PORT_ARG: self.executables[self.batcher_index].get_config().monitoring_endpoint_config.as_ref().expect("Should have monitoring endpoint config").port
192-
});
193-
serialize_to_file(json_data, path);
194-
}
195-
196183
pub fn get_batcher_identifier(&self) -> usize {
197184
// TODO(Nadin): Change return type to service name.
198185
self.batcher_index
199186
}
200187

201-
pub fn get_http_server_index(&self) -> usize {
202-
self.http_server_index
203-
}
204-
205188
pub fn get_state_sync_index(&self) -> usize {
206189
self.state_sync_index
207190
}
@@ -1012,7 +995,6 @@ async fn get_sequencer_setup_configs(
1012995
nodes.push(NodeSetup::new(
1013996
executables,
1014997
batcher_index,
1015-
http_server_index,
1016998
state_sync_index,
1017999
consensus_manager_index,
10181000
add_tx_http_client,

0 commit comments

Comments
 (0)