From cce0aaa7e17c8e1156c655a71a38a7fe4aea73a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 8 Aug 2018 08:30:39 +0300 Subject: [PATCH] MXS-1929: Extend runtime filter test Added testing of how MaxScale displays filters that are destroyed but still in use. --- .../mxs1929_filter_runtime.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/maxscale-system-test/mxs1929_filter_runtime.cpp b/maxscale-system-test/mxs1929_filter_runtime.cpp index 31819a1d2..7429e6813 100644 --- a/maxscale-system-test/mxs1929_filter_runtime.cpp +++ b/maxscale-system-test/mxs1929_filter_runtime.cpp @@ -53,6 +53,31 @@ void basic(TestConnections& test) test.assert(c.check("SELECT 1", "1"), "The filter should be destroyed"); } +void visibility(TestConnections& test) +{ + auto in_list_filters = [&](std::string value) + { + auto res = test.maxctrl("list filters --tsv"); + return res.second.find(value) != string::npos; + }; + + test.check_maxctrl("create filter test1 hintfilter"); + test.assert(in_list_filters("test1"), "The filter should be visible after creation"); + + test.check_maxctrl("destroy filter test1"); + test.assert(!in_list_filters("test1"), "The filter should not be visible after destruction"); + + test.check_maxctrl("create filter test1 hintfilter"); + test.assert(in_list_filters("test1"), "The filter should again be visible after recreation"); + test.assert(!in_list_filters("svc1"), "Filter should not be in use"); + + test.check_maxctrl("alter service filters svc1 test1"); + test.assert(in_list_filters("svc1"), "Service should use the filter"); + + test.check_maxctrl("destroy filter test1"); + test.assert(!in_list_filters("test1"), "The filter should not be visible after destruction"); +} + int main(int argc, char** argv) { TestConnections test(argc, argv); @@ -63,6 +88,9 @@ int main(int argc, char** argv) test.tprintf("Basic test"); basic(test); + test.tprintf("Visibility test"); + visibility(test); + test.tprintf("Destroying servers, monitors and services"); destroy_all(test);