diff --git a/test/cxx/Core/ApplicationPool/PoolTest.cpp b/test/cxx/Core/ApplicationPool/PoolTest.cpp index c2bc70a65d..a4be14c735 100644 --- a/test/cxx/Core/ApplicationPool/PoolTest.cpp +++ b/test/cxx/Core/ApplicationPool/PoolTest.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -632,6 +631,37 @@ namespace tut { ensure_equals(pool->getGroupCount(), 0u); } + TEST_METHOD(15) { + // Test that the process generation increments when the group restarts + Options options = createOptions(); + + // Spawn a process and opens a session with it. + pool->setMax(1); + pool->asyncGet(options, callback); + EVENTUALLY(5, + result = number == 1; + ); + + // Close the session so that the process is now idle. + ProcessPtr process = currentSession->getProcess()->shared_from_this(); + currentSession.reset(); + unsigned int gen1 = process->generation; + + ensure(pool->restartGroupByName(options.appRoot)); + EVENTUALLY(5, + result = pool->getProcessCount() == 1; + ); + pool->asyncGet(options, callback); + EVENTUALLY(5, + result = number == 2; + ); + + process = currentSession->getProcess()->shared_from_this(); + currentSession.reset(); + unsigned int gen2 = process->generation; + ensure_equals(gen1+1,gen2); + } + TEST_METHOD(17) { // Test that restartGroupByName() spawns more processes to ensure // that minProcesses and other constraints are met.