[nexus] fix intermittent failure in Test 1-2-BBR-TC-2 (#12738)

Nexus test 1_2_BBR_TC_2 was occasionally failing at Step 14.
In this step, the previous leader (Router_1) is disabled, and
the DUT (BR_1) is expected to become the new leader and the
Primary Backbone Router (BBR).

The original wait time was 200 seconds (kAttachToRouterTime).
However, analysis showed that routers wait for the MLE Router
ID Timeout (120 seconds) before initiating a new leader election.
Combined with election jitter and BBR registration time, this
sometimes exceeded the 200-second window.

This commit increases the wait time in Step 14 to 400 seconds
(kAttachToRouterTime * 2) to provide sufficient buffer for the
leader transition and BBR registration, effectively resolving
the flake.
This commit is contained in:
Jonathan Hui
2026-03-21 20:31:47 -05:00
committed by GitHub
parent c66c6e41d4
commit d64bdee1bb
+6 -1
View File
@@ -49,6 +49,11 @@ static constexpr uint32_t kAttachToRouterTime = 200 * 1000;
*/
static constexpr uint32_t kStabilizationTime = 10 * 1000;
/**
* Time to advance for leader failover and BBR promotion, in milliseconds.
*/
static constexpr uint32_t kLeaderFailoverTime = 400 * 1000;
/**
* Partition weight for Router_1 to ensure it becomes leader.
*/
@@ -357,7 +362,7 @@ void Test_1_2_BBR_TC_2(void)
*/
Log("Step 14: BR_1 (DUT) becomes Leader and Primary BBR");
nexus.AdvanceTime(kAttachToRouterTime);
nexus.AdvanceTime(kLeaderFailoverTime); // Time for leader failover and BBR promotion (milliseconds)
VerifyOrQuit(br1.Get<Mle::Mle>().IsLeader());
VerifyOrQuit(br1.Get<BackboneRouter::Local>().IsPrimary());