Skip to content

Commit

Permalink
Fix default route race condition UT (sonic-net#258) (sonic-net#268)
Browse files Browse the repository at this point in the history
Approach
What is the motivation for this PR?
Fix the UT failure introduced by sonic-net#254.
The failure is due to that, the wait time for the two default route handlers to finish is 10ms, which is not sufficient on some build image agents which has limited CPU resource.

Signed-off-by: Longxiang Lyu lolv@microsoft.com

Work item tracking
Microsoft ADO (number only): 28471183
How did you do it?
Let's increase the wait time to 8s.

How did you verify/test it?
UT passed.

Any platform specific information?
Documentation
  • Loading branch information
lolyu authored Aug 23, 2024
1 parent 26dbdc7 commit d25788c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/LinkManagerStateMachineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,17 +1551,17 @@ TEST_F(LinkManagerStateMachineTest, DefaultRouteStateRaceCondition)
runIoServiceThreaded(3);

mMuxConfig.enableDefaultRouteFeature(true);
for (int i = 0; i < 10000; ++i)
for (uint i = 0; i < 10000; ++i)
{
MUXLOGDEBUG(boost::format("Iteration %d") % i);
mFakeMuxPort.handleDefaultRouteState("na");
mFakeMuxPort.handleDefaultRouteState("ok");

int check = 0;
while (((mFakeMuxPort.mFakeLinkProber->mShutdownTxProbeCallCount < i + 1) ||
(mFakeMuxPort.mFakeLinkProber->mRestartTxProbeCallCount < i + 1)) && (check < 10))
(mFakeMuxPort.mFakeLinkProber->mRestartTxProbeCallCount < i + 1)) && (check < 4000))
{
usleep(1000);
usleep(2000);
++check;
}

Expand Down

0 comments on commit d25788c

Please sign in to comment.