Skip to content

Commit

Permalink
#1217: tests: add separate testcase for lb keeping last elements
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Jan 26, 2021
1 parent 0a91f53 commit f7eddfa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/vt/vrt/collection/manager.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,7 @@ MigrateStatus CollectionManager::migrateOut(
if (elm_holder->numElements() == 1 and theConfig()->vt_lb_keep_last_elm) {
vt_debug_print(
vrt_coll, node,
"migrateOut: do not migrate last element\n",
"migrateOut: do not migrate last element\n"
);
return MigrateStatus::ElementNotLocal;
}
Expand Down
17 changes: 14 additions & 3 deletions tests/unit/collection/test_lb.extended.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ void colHandler(MyMsg*, MyCol* col) {
}
}

struct TestLoadBalancer : TestParallelHarnessParam<std::string> { };
struct TestLoadBalancer : TestParallelHarnessParam<std::string> {
void runTest();
};

TEST_P(TestLoadBalancer, test_load_balancer_1) {
void TestLoadBalancer::runTest() {
auto lb_name = GetParam();

vt::theConfig()->vt_lb = true;
vt::theConfig()->vt_lb_name = lb_name;
vt::theConfig()->vt_lb_keep_last_elm = true;
if (vt::theContext()->getNode() == 0) {
fmt::print("Testing lb {}\n", lb_name);
}
Expand All @@ -112,6 +113,16 @@ TEST_P(TestLoadBalancer, test_load_balancer_1) {
// Go to the next phase.
vt::thePhase()->nextPhaseCollective();
}
return;
}

TEST_P(TestLoadBalancer, test_load_balancer_1) {
runTest();
}

TEST_P(TestLoadBalancer, test_load_balancer_keep_last_elm) {
vt::theConfig()->vt_lb_keep_last_elm = true;
runTest();
}

auto balancers = ::testing::Values(
Expand Down

0 comments on commit f7eddfa

Please sign in to comment.