MXS-1300: Fix MaxCtrl cluster tests

Fixed tests to use correct functions, extended tests of problematic
cases. Added a secondary directory for the second MaxScale instance.
This commit is contained in:
Markus Mäkelä 2017-08-04 14:02:31 +03:00
parent d2543c4841
commit 8f7be8a4f3
4 changed files with 22 additions and 14 deletions

View File

@ -2,7 +2,6 @@ require('../test_utils.js')()
var cluster = require('../lib/cluster.js')
describe('Cluster Command Internals', function() {
before(startMaxScale)
it('detect added and removed objects', function() {
var a = [
@ -149,7 +148,6 @@ describe('Cluster Command Internals', function() {
cluster.haveExtraServices(b, b).should.be.false
})
after(stopMaxScale)
});
@ -160,7 +158,6 @@ describe('Cluster Commands', function() {
return doCommand('create server server5 127.0.0.1 3003 --hosts 127.0.0.1:8990')
.then(() => verifyCommand('cluster sync 127.0.0.1:8990 --hosts 127.0.0.1:8989',
'servers/server5'))
.should.be.resolved
})
it('sync after server alteration', function() {
@ -182,8 +179,7 @@ describe('Cluster Commands', function() {
it('sync after monitor creation', function() {
return doCommand('create monitor my-monitor-2 mysqlmon --hosts 127.0.0.1:8990')
.then(() => verifyCommand('cluster sync 127.0.0.1:8990 --hosts 127.0.0.1:8989',
'monitors/my-monitor2'))
.should.be.resolved
'monitors/my-monitor-2'))
})
it('sync after monitor alteration', function() {
@ -197,16 +193,17 @@ describe('Cluster Commands', function() {
it('sync after monitor deletion', function() {
return doCommand('destroy monitor my-monitor-2 --hosts 127.0.0.1:8990')
.then(() => verifyCommand('cluster sync 127.0.0.1:8990 --hosts 127.0.0.1:8989',
'monitors/my-monitor-2'))
.should.be.rejected
.then(() => doCommand('show monitor my-monitor-2 --hosts 127.0.0.1:8989'))
.then(() => doCommand('show monitor my-monitor-2 --hosts 127.0.0.1:8990').should.be.rejected)
.then(() => doCommand('cluster sync 127.0.0.1:8990 --hosts 127.0.0.1:8989'))
.then(() => doCommand('show monitor my-monitor-2 --hosts 127.0.0.1:8989').should.be.rejected)
.then(() => doCommand('show monitor my-monitor-2 --hosts 127.0.0.1:8990').should.be.rejected)
})
it('sync listener creation', function() {
return doCommand('create listener RW-Split-Router my-listener-2 5999 --hosts 127.0.0.1:8990')
.then(() => verifyCommand('cluster sync 127.0.0.1:8990 --hosts 127.0.0.1:8989',
'services/RW-Split-Router/listeners/my-listener-2'))
.should.be.resolved
})
it('sync after service alteration', function() {

View File

@ -1,5 +1,6 @@
[maxscale]
threads=4
log_info=1
libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@
logdir=@CMAKE_INSTALL_PREFIX@/log/maxscale/
datadir=@CMAKE_INSTALL_PREFIX@/lib/maxscale

View File

@ -2,11 +2,12 @@
threads=4
log_info=1
libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@
logdir=@CMAKE_INSTALL_PREFIX@/log/maxscale/
datadir=@CMAKE_INSTALL_PREFIX@/lib/maxscale
cachedir=@CMAKE_INSTALL_PREFIX@/cache/maxscale
language=@CMAKE_INSTALL_PREFIX@/lib/maxscale/
piddir=/tmp/
logdir=@CMAKE_INSTALL_PREFIX@/secodary/log/maxscale/
datadir=@CMAKE_INSTALL_PREFIX@/secodary/lib/maxscale
cachedir=@CMAKE_INSTALL_PREFIX@/secodary/cache/maxscale
language=@CMAKE_INSTALL_PREFIX@/secodary/lib/maxscale/
piddir=@CMAKE_INSTALL_PREFIX@/secodary/run/maxscale
config_persistdir=@CMAKE_INSTALL_PREFIX@/secodary/lib/maxscale/
admin_auth=false
admin_port=8990

View File

@ -9,6 +9,15 @@ maxscaledir=$MAXSCALE_DIR
test -z "$MAXSCALE_DIR" && exit 1
rm -r $maxscaledir/secondary/lib/maxscale
rm -r $maxscaledir/secondary/cache/maxscale
rm -r $maxscaledir/secondary/run/maxscale
test -f /tmp/maxadmin.sock && rm /tmp/maxadmin.sock
mkdir -m 0755 -p $maxscaledir/secondary/lib/maxscale
mkdir -m 0755 -p $maxscaledir/secondary/cache/maxscale
mkdir -m 0755 -p $maxscaledir/secondary/run/maxscale
# Start MaxScale
$maxscaledir/bin/maxscale -lstdout -df $maxscaledir/maxscale.cnf >& $maxscaledir/maxscale1.output &