Skip to content

Commit

Permalink
Stabilize bgp_xmpp_wready unit test
Browse files Browse the repository at this point in the history
Some times bgp_xmpp_wready_test unit test fails because route count
check is not deterministic. SendBlock is enabled after the first send,
but it is not always guaranteed that first write has only one route.
It can have data for first two routes as well (one blue and one red)

Change-Id: I47fe20f504b87ffd51063a0145ce598d7c0a4353
Closes-Bug: 1775714
  • Loading branch information
ananth-at-camphor-networks committed Jun 7, 2018
1 parent 4452312 commit ad64b89
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/bgp/test/bgp_xmpp_wready_test.cc
Expand Up @@ -277,14 +277,18 @@ TEST_F(BgpXmppUnitTest, WriteReadyTest) {
WAIT_EQ(4, bgp_channel_manager_->channel_->Count());
BGP_DEBUG_UT("Received route for blue at Server \n ");

// We may receive one or two routes depending on when the write-block
// takes effect.
TASK_UTIL_EXPECT_GE(2, agent_a_->RouteCount());

agent_a_->AddRoute("red","20.1.1.1/32");
WAIT_EQ(5, bgp_channel_manager_->channel_->Count());
BGP_DEBUG_UT("Received route for red at Server \n ");

// send blocked, no route should be reflected back after the first one.
// check a few times to make sure that no more routes are reflected
// send blocked, no route should be reflected back after the first one
// or two. check a few times to make sure that no more routes are reflected.
for (int idx = 0; idx < 10; ++idx) {
WAIT_EQ(1, agent_a_->RouteCount());
TASK_UTIL_EXPECT_GE(2, agent_a_->RouteCount());
usleep(10000);
task_util::WaitForIdle();
}
Expand Down

0 comments on commit ad64b89

Please sign in to comment.