diff --git a/tests/test/scheduler/test_function_migration.cpp b/tests/test/scheduler/test_function_migration.cpp index 5f612e379..322631214 100644 --- a/tests/test/scheduler/test_function_migration.cpp +++ b/tests/test/scheduler/test_function_migration.cpp @@ -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 hosts = { masterHost, "hostA" }; + std::vector> 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); +} }