Improve MaxCtrl test coverage

A few missing cases that simple to solve were reported by the coverage
tool.
This commit is contained in:
Markus Mäkelä 2018-08-10 21:46:38 +03:00
parent 46dee98b25
commit 57471c7baa
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
5 changed files with 32 additions and 1 deletions

View File

@ -16,7 +16,7 @@ describe("API", function() {
})
})
it('sums integer values', function() {
it('sums zero integer values', function() {
return doCommand('api get servers data[].attributes.statistics.connections --sum')
.then((res) => {
js = JSON.parse(res)
@ -24,6 +24,14 @@ describe("API", function() {
})
})
it('sums non-zero integer values', function() {
return doCommand('api get --sum maxscale/threads data[].attributes.stats.reads')
.then((res) => {
js = JSON.parse(res)
js.should.be.a('number')
})
})
it('does not sum string values', function() {
return doCommand('api get servers data[].id --sum')
.then((res) => {

View File

@ -20,5 +20,10 @@ describe("Module Commands", function() {
.should.be.rejected
})
it('call unknown command', function() {
return doCommand('call command mariadbmon log')
.should.be.rejected
})
after(stopMaxScale)
});

View File

@ -239,5 +239,16 @@ describe("Create/Destroy Commands", function() {
.should.be.fulfilled
})
it('create filter with no parameters', function() {
return verifyCommand('create filter test-filter hintfilter',
'filters/test-filter')
.should.be.fulfilled
})
it('destroy filter with no parameters', function() {
return doCommand('destroy filter test-filter')
.should.be.fulfilled
})
after(stopMaxScale)
});

View File

@ -10,6 +10,7 @@ var tests = [
'list modules',
'list users',
'list commands',
'list threads',
'show servers',
'show services',
'show monitors',
@ -19,6 +20,7 @@ var tests = [
'show maxscale',
'show logging',
'show threads',
'show thread 0',
'show server server1',
'show service RW-Split-Router',
'show monitor MariaDB-Monitor',

View File

@ -70,6 +70,11 @@ describe("Library invocation", function() {
.should.be.fulfilled
})
it('no command', function() {
return ctrl.execute([], {})
.should.be.rejected
})
it('reject on connection failure', function() {
stopMaxScale()
.then(function() {