MXS-1300: Reorganize and refactor tests
The tests are now sorted by command type. This allows for more consistent test creation as tests can be done per source code file instead of per object type. Added helper functions for common testing operations. The two main ones are doCommand, which executes a MaxCtrl command and returns a result, and verifyCommand, that executes a command and verifies the result via the REST API.
This commit is contained in:
38
maxctrl/test/startstop.js
Normal file
38
maxctrl/test/startstop.js
Normal file
@ -0,0 +1,38 @@
|
||||
require('../test_utils.js')()
|
||||
|
||||
var ctrl = require('../lib/core.js')
|
||||
var opts = { extra_args: [ '--quiet'] }
|
||||
|
||||
describe("Start/Stop Commands", function() {
|
||||
before(startMaxScale)
|
||||
|
||||
it('stop service', function() {
|
||||
return verifyCommand('stop service Read-Connection-Router', 'services/Read-Connection-Router')
|
||||
.then(function(res) {
|
||||
res.data.attributes.state.should.equal("Stopped")
|
||||
})
|
||||
})
|
||||
|
||||
it('start service', function() {
|
||||
return verifyCommand('start service Read-Connection-Router', 'services/Read-Connection-Router')
|
||||
.then(function(res) {
|
||||
res.data.attributes.state.should.equal("Started")
|
||||
})
|
||||
})
|
||||
|
||||
it('stop monitor', function() {
|
||||
return verifyCommand('stop monitor MySQL-Monitor', 'monitors/MySQL-Monitor')
|
||||
.then(function(res) {
|
||||
res.data.attributes.state.should.equal("Stopped")
|
||||
})
|
||||
})
|
||||
|
||||
it('start monitor', function() {
|
||||
return verifyCommand('start monitor MySQL-Monitor', 'monitors/MySQL-Monitor')
|
||||
.then(function(res) {
|
||||
res.data.attributes.state.should.equal("Running")
|
||||
})
|
||||
})
|
||||
|
||||
after(stopMaxScale)
|
||||
});
|
Reference in New Issue
Block a user