MaxScale/maxctrl/test/states.js
Markus Mäkelä c9f3d014d6 MXS-1300: Improve test coverage
The tests now cover 100% of all source files with the exception of the
call.js and common.js source files.
2017-07-23 08:21:00 +03:00

37 lines
1.0 KiB
JavaScript

require('../test_utils.js')()
describe("Set/Clear Commands", function() {
before(function() {
return startMaxScale()
.then(function() {
return request.put(host + 'monitors/MySQL-Monitor/stop')
})
})
it('set correct state', function() {
return verifyCommand('set server server2 master', 'servers/server2')
.then(function(res) {
res.data.attributes.state.should.match(/Master/)
})
})
it('clear correct state', function() {
return verifyCommand('clear server server2 master', 'servers/server2')
.then(function(res) {
res.data.attributes.state.should.not.match(/Master/)
})
})
it('set incorrect state', function() {
return doCommand('set server server2 something')
.should.be.rejected
})
it('clear incorrect state', function() {
return doCommand('clear server server2 something')
.should.be.rejected
})
after(stopMaxScale)
});