Skip to content

Commit

Permalink
Make BgpStressTest::VerifyRoutingInstances more robust
Browse files Browse the repository at this point in the history
Change-Id: Iea91ad3107c8782dc6f0661cfd3cafaabcc18323
Partial-Bug: 1464016
  • Loading branch information
Nischal Sheth committed Jun 10, 2015
1 parent 4c660d5 commit a02166f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/bgp/test/bgp_stress_test.cc
Expand Up @@ -633,17 +633,19 @@ void BgpStressTest::SandeshShutdown() {
WaitForIdle();
}

bool BgpStressTest::CheckRoutingInstance(int instance_id) {
task_util::TaskSchedulerLock lock;
std::string name = GetInstanceName(instance_id);
return (server_->routing_instance_mgr()->GetRoutingInstance(name) != NULL);
}

void BgpStressTest::VerifyRoutingInstances() {
for (int instance_id = 0; instance_id < (int) instances_.size();
++instance_id) {
if (instances_[instance_id]) {
TASK_UTIL_EXPECT_NE(static_cast<RoutingInstance *>(NULL),
server_->routing_instance_mgr()->\
GetRoutingInstance(GetInstanceName(instance_id)));
TASK_UTIL_EXPECT_TRUE(CheckRoutingInstance(instance_id));
} else {
TASK_UTIL_EXPECT_EQ(static_cast<RoutingInstance *>(NULL),
server_->routing_instance_mgr()->\
GetRoutingInstance(GetInstanceName(instance_id)));
TASK_UTIL_EXPECT_FALSE(CheckRoutingInstance(instance_id));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/bgp/test/bgp_stress_test.h
Expand Up @@ -291,6 +291,7 @@ class BgpStressTest : public ::testing::TestWithParam<TestParams> {
void AgentCleanup();
void Cleanup();
void SandeshShutdown();
bool CheckRoutingInstance(int instance_id);
void VerifyRoutingInstances();
Ip4Prefix GetAgentRoute(int agent_id, int instance_id, int route_id);

Expand Down

0 comments on commit a02166f

Please sign in to comment.