Improve MaxCtrl test coverage
A few missing cases that simple to solve were reported by the coverage tool.
This commit is contained in:
@ -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')
|
return doCommand('api get servers data[].attributes.statistics.connections --sum')
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
js = JSON.parse(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() {
|
it('does not sum string values', function() {
|
||||||
return doCommand('api get servers data[].id --sum')
|
return doCommand('api get servers data[].id --sum')
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|||||||
@ -20,5 +20,10 @@ describe("Module Commands", function() {
|
|||||||
.should.be.rejected
|
.should.be.rejected
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('call unknown command', function() {
|
||||||
|
return doCommand('call command mariadbmon log')
|
||||||
|
.should.be.rejected
|
||||||
|
})
|
||||||
|
|
||||||
after(stopMaxScale)
|
after(stopMaxScale)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -239,5 +239,16 @@ describe("Create/Destroy Commands", function() {
|
|||||||
.should.be.fulfilled
|
.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)
|
after(stopMaxScale)
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,6 +10,7 @@ var tests = [
|
|||||||
'list modules',
|
'list modules',
|
||||||
'list users',
|
'list users',
|
||||||
'list commands',
|
'list commands',
|
||||||
|
'list threads',
|
||||||
'show servers',
|
'show servers',
|
||||||
'show services',
|
'show services',
|
||||||
'show monitors',
|
'show monitors',
|
||||||
@ -19,6 +20,7 @@ var tests = [
|
|||||||
'show maxscale',
|
'show maxscale',
|
||||||
'show logging',
|
'show logging',
|
||||||
'show threads',
|
'show threads',
|
||||||
|
'show thread 0',
|
||||||
'show server server1',
|
'show server server1',
|
||||||
'show service RW-Split-Router',
|
'show service RW-Split-Router',
|
||||||
'show monitor MariaDB-Monitor',
|
'show monitor MariaDB-Monitor',
|
||||||
|
|||||||
@ -70,6 +70,11 @@ describe("Library invocation", function() {
|
|||||||
.should.be.fulfilled
|
.should.be.fulfilled
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('no command', function() {
|
||||||
|
return ctrl.execute([], {})
|
||||||
|
.should.be.rejected
|
||||||
|
})
|
||||||
|
|
||||||
it('reject on connection failure', function() {
|
it('reject on connection failure', function() {
|
||||||
stopMaxScale()
|
stopMaxScale()
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user