Fill the gaps in MaxCtrl testing

The MaxCtrl test suite now covers most of the code that can be tested
within reasonable limits. Also removed some dead code in `list servers`.
This commit is contained in:
Markus Mäkelä 2018-08-09 12:36:40 +03:00
parent 50c20e79ee
commit f6cd8b6454
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
4 changed files with 37 additions and 9 deletions

View File

@ -71,15 +71,6 @@ exports.builder = function(yargs) {
.then(() => filterResource(res, fields))
.then((res) => rawCollectionAsTable(res, fields))
})
return getRawCollection(host, 'servers', fields)
.then((res) => {
res.forEach((i) => {
// The server name will be first
//console.log(i[0])
})
return rawCollectionAsTable(res, fields);
})
})
})
.command('services', 'List services', function(yargs) {

View File

@ -44,6 +44,17 @@ describe("Alter Commands", function() {
})
})
it('alter service filters', function() {
return verifyCommand('alter service-filters Read-Connection-Router', 'services/Read-Connection-Router')
.then(function(res) {
res.data.relationships.should.not.have.keys("filters")
})
.then(() => verifyCommand('alter service-filters Read-Connection-Router QLA', 'services/Read-Connection-Router'))
.then(function(res) {
res.data.relationships.filters.data.length.should.equal(1)
})
})
it('will not alter non-existent service parameter', function() {
return doCommand('alter service Read-Connection-Router turbocharge yes-please')
.should.be.rejected

View File

@ -198,6 +198,31 @@ describe("Create/Destroy Commands", function() {
.should.be.fulfilled
})
it('destroy service with server relationships', function() {
return doCommand('destroy service test-service')
.should.be.rejected
.then(() => doCommand('unlink service test-service test-server'))
.then(() => doCommand('destroy service test-service'))
.should.be.fulfilled
})
it('create service with filter relationship', function() {
return doCommand('create filter test-filter-1 qlafilter filebase=/tmp/qla')
.then(() => verifyCommand('create service test-service-2 readwritesplit user=maxuser password=maxpwd --filters test-filter-1',
'services/test-service-2'))
.then((res) => {
res.data.relationships.filters.data.length.should.equal(1)
})
})
it('destroy service with filter relationships', function() {
return doCommand('destroy service test-service-2')
.should.be.rejected
.then(() => doCommand('alter service-filters test-service-2'))
.then(() => doCommand('destroy service test-service-2'))
.should.be.fulfilled
})
it('create filter with bad parameters', function() {
return doCommand('create filter test-filter qlafilter filebase-not-required')
.should.be.rejected

View File

@ -18,6 +18,7 @@ var tests = [
'show modules',
'show maxscale',
'show logging',
'show threads',
'show server server1',
'show service RW-Split-Router',
'show monitor MariaDB-Monitor',