Skip to content

Commit

Permalink
Make service_chain_test more robust
Browse files Browse the repository at this point in the history
Change-Id: Ib9b6b81fec3333cd52b5b4dbf81cd22a7b9ea261
Partial-Bug: 1548570
  • Loading branch information
Nischal Sheth committed Feb 29, 2016
1 parent f14892a commit 66753a8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/bgp/test/service_chain_test.cc
Expand Up @@ -618,18 +618,24 @@ class ServiceChainTest : public ::testing::Test {
return dynamic_cast<BgpRoute *>(db_entry);
}

BgpRoute *VerifyRouteExists(const string &instance, const string &prefix) {
TASK_UTIL_EXPECT_TRUE(RouteLookup(instance, prefix) != NULL);
bool CheckRouteExists(const string &instance, const string &prefix) {
task_util::TaskSchedulerLock lock;
BgpRoute *rt = RouteLookup(instance, prefix);
if (rt == NULL) {
return NULL;
}
TASK_UTIL_EXPECT_TRUE(rt->BestPath() != NULL);
return rt;
return (rt && rt->BestPath() != NULL);
}

void VerifyRouteExists(const string &instance, const string &prefix) {
TASK_UTIL_EXPECT_TRUE(CheckRouteExists(instance, prefix));
}

bool CheckRouteNoExists(const string &instance, const string &prefix) {
task_util::TaskSchedulerLock lock;
BgpRoute *rt = RouteLookup(instance, prefix);
return !rt;
}

void VerifyRouteNoExists(const string &instance, const string &prefix) {
TASK_UTIL_EXPECT_TRUE(RouteLookup(instance, prefix) == NULL);
TASK_UTIL_EXPECT_TRUE(CheckRouteNoExists(instance, prefix));
}

void VerifyRouteIsDeleted(const string &instance, const string &prefix) {
Expand Down

0 comments on commit 66753a8

Please sign in to comment.