From 8f7be8a4f3bf38e27da98b85a59ec524ffd76134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 4 Aug 2017 14:02:31 +0300 Subject: [PATCH] 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. --- maxctrl/test/cluster.js | 15 ++++++--------- test/maxscale_test.cnf | 1 + test/maxscale_test_secondary.cnf | 11 ++++++----- test/start_double_maxscale.sh | 9 +++++++++ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/maxctrl/test/cluster.js b/maxctrl/test/cluster.js index 66284d9e3..04ee4cc22 100644 --- a/maxctrl/test/cluster.js +++ b/maxctrl/test/cluster.js @@ -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() { diff --git a/test/maxscale_test.cnf b/test/maxscale_test.cnf index f2ec30ac6..455a77b7b 100644 --- a/test/maxscale_test.cnf +++ b/test/maxscale_test.cnf @@ -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 diff --git a/test/maxscale_test_secondary.cnf b/test/maxscale_test_secondary.cnf index 34d61c9de..2b213317c 100644 --- a/test/maxscale_test_secondary.cnf +++ b/test/maxscale_test_secondary.cnf @@ -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 diff --git a/test/start_double_maxscale.sh b/test/start_double_maxscale.sh index 46c775c36..68bf321ad 100755 --- a/test/start_double_maxscale.sh +++ b/test/start_double_maxscale.sh @@ -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 &