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.
This commit is contained in:
parent
c56ef3cc27
commit
f3a64f0b56
@ -93,7 +93,7 @@ exports.builder = function(yargs) {
|
||||
return updateValue(host, 'services/' + argv.service, 'data.attributes.parameters.' + argv.key, argv.value)
|
||||
})
|
||||
})
|
||||
.command('service filters <service> [filters...]', 'Alter filters of a service', function(yargs) {
|
||||
.command('service-filters <service> [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 <service> [filters...]')
|
||||
.usage('Usage: alter service-filters <service> [filters...]')
|
||||
}, function(argv) {
|
||||
maxctrl(argv, function(host) {
|
||||
return setFilters(host, argv)
|
||||
|
@ -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());
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user