Skip to content

Commit

Permalink
tests: add further testing
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Jan 9, 2022
1 parent 13560b3 commit aed0533
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test/scheduler/test_function_migration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,25 @@ TEST_CASE_METHOD(
sch.checkForMigrationOpportunities();
REQUIRE(sch.canAppBeMigrated(appId) == nullptr);
}

TEST_CASE_METHOD(FunctionMigrationTestFixture,
"Test adding and removing pending migrations manually",
"[scheduler]")
{
auto req = faabric::util::batchExecFactory("foo", "sleep", 2);
uint32_t appId = req->messages().at(0).appid();
std::vector<std::string> hosts = { masterHost, "hostA" };
std::vector<std::pair<int, int>> migrations = { { 1, 0 } };
auto expectedMigrations =
buildPendingMigrationsExpectation(req, hosts, migrations);

// Add migration manually
REQUIRE(sch.canAppBeMigrated(appId) == nullptr);
sch.addPendingMigration(expectedMigrations);
REQUIRE(sch.canAppBeMigrated(appId) == expectedMigrations);

// Remove migration manually
sch.removePendingMigration(appId);
REQUIRE(sch.canAppBeMigrated(appId) == nullptr);
}
}

0 comments on commit aed0533

Please sign in to comment.