MXS-1929: Reject promise on invalid input

If a value that is not of key-value format was given to the create
commands, the code previously threw an exception. This causes tests to
misbehave so changing it to a rejected promise is more appropriate.
This commit is contained in:
Markus Mäkelä
2018-08-09 12:26:33 +03:00
parent db09996bb8
commit 50c20e79ee
2 changed files with 89 additions and 50 deletions

View File

@ -120,6 +120,16 @@ describe("Create/Destroy Commands", function() {
.should.be.rejected
})
it('will not create listener with negative port', function() {
return doCommand('create listener RW-Split-Router my-listener3 -123')
.should.be.rejected
})
it('will not create listener with port that is not a number', function() {
return doCommand('create listener RW-Split-Router my-listener3 any-port-is-ok')
.should.be.rejected
})
it('destroy listener', function() {
return doCommand('destroy listener RW-Split-Router my-listener')
.should.be.fulfilled
@ -165,6 +175,11 @@ describe("Create/Destroy Commands", function() {
.should.be.rejected
})
it('create service with bad parameter', function() {
return doCommand('create service test-service readwritesplit user-not-required')
.should.be.rejected
})
it('create service', function() {
return verifyCommand('create service test-service readwritesplit user=maxuser password=maxpwd',
'services/test-service')
@ -183,6 +198,11 @@ describe("Create/Destroy Commands", function() {
.should.be.fulfilled
})
it('create filter with bad parameters', function() {
return doCommand('create filter test-filter qlafilter filebase-not-required')
.should.be.rejected
})
it('create filter', function() {
return verifyCommand('create filter test-filter qlafilter filebase=/tmp/qla.log',
'filters/test-filter')