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:
@ -1,9 +1,12 @@
|
||||
require('../test_utils.js')()
|
||||
|
||||
var ctrl = require('../lib/core.js')
|
||||
var opts = { extra_args: [ '--quiet'] }
|
||||
|
||||
var tests = [
|
||||
'list servers',
|
||||
'list services',
|
||||
'list listeners RW-Split-Router',
|
||||
'list monitors',
|
||||
'list sessions',
|
||||
'list filters',
|
||||
@ -24,9 +27,7 @@ describe("Diagnostic commands", function() {
|
||||
|
||||
tests.forEach(function(i) {
|
||||
it(i, function() {
|
||||
return ctrl.execute(i.split(' '), {
|
||||
extra_args: [ '--quiet']
|
||||
})
|
||||
return doCommand(i)
|
||||
.should.be.fulfilled
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user