Skip to content

Commit 3ab843d

Browse files
authored
[Tests] Jts timeout fix (#1207)
* typos fix * increased bootstrap & transaction wait * changed bootstrap sequence for some tests
1 parent fd63c03 commit 3ab843d

File tree

4 files changed

+35
-26
lines changed

4 files changed

+35
-26
lines changed

jormungandr-scenario-tests/src/node.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ error_chain! {
6565

6666
FragmentIsPendingForTooLong (fragment_id: FragmentId, duration: Duration) {
6767
description("fragment is pending for too long"),
68-
display("fragment '{}' is pending for tool long ({} s)", fragment_id, duration.as_secs()),
68+
display("fragment '{}' is pending for too long ({} s)", fragment_id, duration.as_secs()),
6969
}
7070
}
7171
}
@@ -284,7 +284,7 @@ impl NodeController {
284284
}
285285

286286
pub fn wait_fragment(&self, duration: Duration, check: MemPoolCheck) -> Result<FragmentStatus> {
287-
let max_try = 20;
287+
let max_try = 50;
288288
for _ in 0..max_try {
289289
let logs = self.fragment_logs()?;
290290

@@ -335,8 +335,8 @@ impl NodeController {
335335
}
336336

337337
pub fn wait_for_bootstrap(&self) -> Result<()> {
338-
let max_try = 20;
339-
let sleep = Duration::from_secs(1);
338+
let max_try = 40;
339+
let sleep = Duration::from_secs(2);
340340
for _ in 0..max_try {
341341
let stats = self.stats();
342342
if let Ok(stats) = stats {

jormungandr-scenario-tests/src/test/comm/passive_leader.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ pub fn transaction_to_passive(mut context: Context<ChaChaRng>) -> Result<Scenari
3434
controller.monitor_nodes();
3535
let leader =
3636
controller.spawn_node(LEADER, LeadershipMode::Leader, PersistenceMode::InMemory)?;
37+
leader.wait_for_bootstrap()?;
3738
let passive =
3839
controller.spawn_node(PASSIVE, LeadershipMode::Passive, PersistenceMode::InMemory)?;
39-
leader.wait_for_bootstrap()?;
4040
passive.wait_for_bootstrap()?;
4141

4242
let mut wallet1 = controller.wallet("unassigned1")?;
@@ -153,12 +153,13 @@ pub fn passive_node_is_updated(mut context: Context<ChaChaRng>) -> Result<Scenar
153153
let mut controller = scenario_settings.build(context)?;
154154

155155
controller.monitor_nodes();
156-
let passive =
157-
controller.spawn_node(PASSIVE, LeadershipMode::Passive, PersistenceMode::InMemory)?;
156+
158157
let leader =
159158
controller.spawn_node(LEADER, LeadershipMode::Leader, PersistenceMode::InMemory)?;
160-
161159
leader.wait_for_bootstrap()?;
160+
161+
let passive =
162+
controller.spawn_node(PASSIVE, LeadershipMode::Passive, PersistenceMode::InMemory)?;
162163
passive.wait_for_bootstrap()?;
163164

164165
let mut wallet1 = controller.wallet("unassigned1")?;

jormungandr-scenario-tests/src/test/network/topology/scenarios.rs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const LEADER_5: &str = "Leader5";
1515
const LEADER_6: &str = "Leader6";
1616
const LEADER_7: &str = "Leader7";
1717

18+
const CORE_NODE: &str = "Core";
1819
const RELAY_NODE_1: &str = "Relay1";
1920
const RELAY_NODE_2: &str = "Relay2";
2021

@@ -412,8 +413,9 @@ pub fn relay(mut context: Context<ChaChaRng>) -> Result<ScenarioResult> {
412413
"T3007-Relay",
413414
&mut context,
414415
topology [
415-
RELAY_NODE_1 -> RELAY_NODE_2,
416-
RELAY_NODE_2 -> RELAY_NODE_1,
416+
CORE_NODE,
417+
RELAY_NODE_1 -> CORE_NODE,
418+
RELAY_NODE_2 -> CORE_NODE,
417419
LEADER_1 -> RELAY_NODE_1,
418420
LEADER_2 -> RELAY_NODE_1,
419421
LEADER_3 -> RELAY_NODE_1,
@@ -441,6 +443,26 @@ pub fn relay(mut context: Context<ChaChaRng>) -> Result<ScenarioResult> {
441443

442444
let mut controller = scenario_settings.build(context.clone())?;
443445

446+
let core =
447+
controller.spawn_node(CORE_NODE, LeadershipMode::Leader, PersistenceMode::InMemory)?;
448+
449+
controller.monitor_nodes();
450+
core.wait_for_bootstrap()?;
451+
452+
let relay1 = controller.spawn_node(
453+
RELAY_NODE_1,
454+
LeadershipMode::Passive,
455+
PersistenceMode::InMemory,
456+
)?;
457+
let relay2 = controller.spawn_node(
458+
RELAY_NODE_2,
459+
LeadershipMode::Passive,
460+
PersistenceMode::InMemory,
461+
)?;
462+
463+
relay2.wait_for_bootstrap()?;
464+
relay1.wait_for_bootstrap()?;
465+
444466
let leader1 =
445467
controller.spawn_node(LEADER_1, LeadershipMode::Leader, PersistenceMode::InMemory)?;
446468
let leader2 =
@@ -455,21 +477,7 @@ pub fn relay(mut context: Context<ChaChaRng>) -> Result<ScenarioResult> {
455477
controller.spawn_node(LEADER_6, LeadershipMode::Leader, PersistenceMode::InMemory)?;
456478
let leader7 =
457479
controller.spawn_node(LEADER_7, LeadershipMode::Leader, PersistenceMode::InMemory)?;
458-
let relay1 = controller.spawn_node(
459-
RELAY_NODE_1,
460-
LeadershipMode::Passive,
461-
PersistenceMode::InMemory,
462-
)?;
463-
let relay2 = controller.spawn_node(
464-
RELAY_NODE_2,
465-
LeadershipMode::Passive,
466-
PersistenceMode::InMemory,
467-
)?;
468480

469-
controller.monitor_nodes();
470-
471-
relay2.wait_for_bootstrap()?;
472-
relay1.wait_for_bootstrap()?;
473481
leader7.wait_for_bootstrap()?;
474482
leader6.wait_for_bootstrap()?;
475483
leader5.wait_for_bootstrap()?;

jormungandr-scenario-tests/src/test/utils/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ pub fn assert_are_in_sync(nodes: Vec<&NodeController>) -> Result<()> {
4343
assert_equals(
4444
&expected_block_hashes,
4545
&all_block_hashes,
46-
"nodes are out of sync (different bock hashes)",
46+
"nodes are out of sync (different block hashes)",
4747
)?;
4848
assert_equals(
4949
&block_height,
5050
&node.stats()?.last_block_height,
51-
"nodes are out of sync (different bock height)",
51+
"nodes are out of sync (different block height)",
5252
)?;
5353
}
5454
Ok(())

0 commit comments

Comments
 (0)