Skip to content

Commit

Permalink
add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
CamJN committed Sep 23, 2024
1 parent 38187b2 commit a376e8e
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion test/cxx/Core/ApplicationPool/PoolTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <FileTools/FileManip.h>
#include <StrIntTools/StrIntUtils.h>
#include <IOTools/MessageSerialization.h>
#include <map>
#include <vector>
#include <cerrno>
#include <signal.h>
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a376e8e

Please sign in to comment.