From f3a64f0b569725f791fe84c48c13e234463fbcde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 8 Aug 2018 09:37:39 +0300 Subject: [PATCH] MXS-1929: Rename `alter service filters` The command naming caused problems when other parts of the service were being altered. The parser doesn't seem to handle the case of overlapping commands that well. Updated test cases with new code and adjusted syntax accordingly. --- maxctrl/lib/alter.js | 4 ++-- maxscale-system-test/alter_router.cpp | 8 +++----- maxscale-system-test/mxs1929_filter_runtime.cpp | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/maxctrl/lib/alter.js b/maxctrl/lib/alter.js index d522f00e5..6635772e8 100644 --- a/maxctrl/lib/alter.js +++ b/maxctrl/lib/alter.js @@ -93,7 +93,7 @@ exports.builder = function(yargs) { return updateValue(host, 'services/' + argv.service, 'data.attributes.parameters.' + argv.key, argv.value) }) }) - .command('service filters [filters...]', 'Alter filters of a service', function(yargs) { + .command('service-filters [filters...]', 'Alter filters of a service', function(yargs) { return yargs.epilog('The order of the filters given as the second parameter will also be the order ' + 'in which queries pass through the filter chain. If no filters are given, all ' + 'existing filters are removed from the service.' + @@ -102,7 +102,7 @@ exports.builder = function(yargs) { 'will set the filter chain for the service `my-service` so that A gets the ' + 'query first after which it is passed to B and finally to C. This behavior is ' + 'the same as if the `filters=A|B|C` parameter was defined for the service.') - .usage('Usage: alter service filters [filters...]') + .usage('Usage: alter service-filters [filters...]') }, function(argv) { maxctrl(argv, function(host) { return setFilters(host, argv) diff --git a/maxscale-system-test/alter_router.cpp b/maxscale-system-test/alter_router.cpp index e84349117..fc2f3d9ab 100644 --- a/maxscale-system-test/alter_router.cpp +++ b/maxscale-system-test/alter_router.cpp @@ -20,7 +20,7 @@ void alter_readwritesplit(TestConnections& test) test.maxscales->wait_for_monitor(); first.connect(); - test.maxscales->ssh_node_f(0, true, "maxctrl alter service RW-Split-Router master_failure_mode fail_on_write"); + test.check_maxctrl("alter service RW-Split-Router master_failure_mode fail_on_write"); second.connect(); // Check that writes work for both connections @@ -75,8 +75,7 @@ void alter_readconnroute(TestConnections& test) row[0].c_str(), master_id.c_str()); } - int rc = test.maxscales->ssh_node_f(0, true, "maxctrl alter service Read-Connection-Router-Master router_options slave"); - test.assert(rc == 0, "Readconnroute alteration should work"); + test.check_maxctrl("alter service Read-Connection-Router-Master router_options slave"); for (int i = 0; i < 5; i++) { @@ -95,8 +94,7 @@ void alter_schemarouter(TestConnections& test) test.assert(!conn.query("SELECT 1"), "Query before reconfiguration should fail"); conn.disconnect(); - int rc = test.maxscales->ssh_node_f(0, true, "maxctrl alter service SchemaRouter ignore_databases_regex '.*'"); - test.assert(rc == 0, "Schemarouter alteration should work"); + test.check_maxctrl("alter service SchemaRouter ignore_databases_regex '.*'"); conn.connect(); test.assert(conn.query("SELECT 1"), "Query after reconfiguration should work: %s", conn.error()); diff --git a/maxscale-system-test/mxs1929_filter_runtime.cpp b/maxscale-system-test/mxs1929_filter_runtime.cpp index 7429e6813..55a553090 100644 --- a/maxscale-system-test/mxs1929_filter_runtime.cpp +++ b/maxscale-system-test/mxs1929_filter_runtime.cpp @@ -32,7 +32,7 @@ void destroy_all(TestConnections& test) void basic(TestConnections& test) { 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 test1"); Connection c = test.maxscales->rwsplit(); c.connect(); @@ -42,7 +42,7 @@ void basic(TestConnections& test) auto res = test.maxctrl("destroy filter test1"); test.assert(res.first != 0, "Destruction should fail when filter is in use"); - test.check_maxctrl("alter service filters svc1"); + test.check_maxctrl("alter service-filters svc1"); test.check_maxctrl("destroy filter test1"); test.assert(c.check("SELECT 1", "2"), "The filter should not yet be destroyed"); @@ -71,7 +71,7 @@ void visibility(TestConnections& test) 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.check_maxctrl("alter service-filters svc1 test1"); test.assert(in_list_filters("svc1"), "Service should use the filter"); test.check_maxctrl("destroy filter test1");