diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs1929_filter_runtime b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1929_filter_runtime index a80463fa0..584eabd7e 100644 --- a/maxscale-system-test/cnf/maxscale.cnf.template.mxs1929_filter_runtime +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1929_filter_runtime @@ -1,6 +1,5 @@ [maxscale] threads=###threads### -log_info=1 [CLI] type=service diff --git a/maxscale-system-test/mxs1929_filter_runtime.cpp b/maxscale-system-test/mxs1929_filter_runtime.cpp index 55a553090..c3edb2d91 100644 --- a/maxscale-system-test/mxs1929_filter_runtime.cpp +++ b/maxscale-system-test/mxs1929_filter_runtime.cpp @@ -3,7 +3,11 @@ */ #include "testconnections.h" + #include +#include +#include +#include using namespace std; @@ -74,10 +78,60 @@ void visibility(TestConnections& test) test.check_maxctrl("alter service-filters svc1 test1"); test.assert(in_list_filters("svc1"), "Service should use the filter"); + test.check_maxctrl("alter service-filters svc1"); + test.assert(!in_list_filters("svc1"), "Service should not use the filter"); + test.check_maxctrl("destroy filter test1"); test.assert(!in_list_filters("test1"), "The filter should not be visible after destruction"); } +void load(TestConnections& test) +{ + std::vector threads; + std::atomic running{true}; + using std::chrono::milliseconds; + + auto func = [&]() + { + while (running) + { + Connection c = test.maxscales->rwsplit(); + c.connect(); + + while (running) + { + test.assert(c.query("select 1"), "Query should succeed: %s", c.error()); + } + } + }; + + for (int i = 0; i < 10; i++) + { + threads.emplace_back(func); + } + + for (int i = 0; i < 10; i++) + { + test.check_maxctrl("create filter test1 regexfilter \"match=SELECT 1\" \"replace=SELECT 2\""); + test.check_maxctrl("alter service-filters svc1 test1"); + test.check_maxctrl("alter service-filters svc1"); + test.check_maxctrl("destroy filter test1"); + std::cout << "."; + std::cout.flush(); + } + + std::cout << std::endl; + running = false; + + for (auto& a : threads) + { + test.set_timeout(60); + a.join(); + } + + test.stop_timeout(); +} + int main(int argc, char** argv) { TestConnections test(argc, argv); @@ -91,6 +145,9 @@ int main(int argc, char** argv) test.tprintf("Visibility test"); visibility(test); + test.tprintf("Load test"); + load(test); + test.tprintf("Destroying servers, monitors and services"); destroy_all(test);