From 824166d14a8fa8fee71bd9c2ca478236db5c9801 Mon Sep 17 00:00:00 2001 From: Camden Narzt Date: Mon, 23 Sep 2024 15:34:09 -0600 Subject: [PATCH] test stub for proper testing of routing algo --- test/cxx/Core/ApplicationPool/PoolTest.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/cxx/Core/ApplicationPool/PoolTest.cpp b/test/cxx/Core/ApplicationPool/PoolTest.cpp index a4be14c735..3bb0e4ce44 100644 --- a/test/cxx/Core/ApplicationPool/PoolTest.cpp +++ b/test/cxx/Core/ApplicationPool/PoolTest.cpp @@ -662,6 +662,35 @@ namespace tut { ensure_equals(gen1+1,gen2); } + TEST_METHOD(16) { + // Test that the correct process from the pool is routed + Options options = createOptions(); + ensureMinProcesses(2); + + // async restart the group + ensure(pool->restartGroupByName(options.appRoot)); + ensureMinProcesses(1); + + /* + Imagine we have these processes (ordered from oldest to newest): + + #. PID 1 (generation A, busyness 5) + #. PID 2 (generation A, busyness 3) + #. PID 3 (generation B, busyness 1) + + The algorithm should select PID 3 + */ + + /* + Imagine we have these processes (ordered from oldest to newest): + + #. PID 1 (generation A, busyness 1) + #. PID 2 (generation B, busyness 5) + + The algorithm should select PID 1 + */ + } + TEST_METHOD(17) { // Test that restartGroupByName() spawns more processes to ensure // that minProcesses and other constraints are met.