diff --git a/CMakeLists.txt b/CMakeLists.txt index 333165b57..b48cbfe46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,7 @@ configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.h.in ${CMAKE_BINARY configure_file(${CMAKE_SOURCE_DIR}/etc/postinst.in ${CMAKE_BINARY_DIR}/postinst @ONLY) configure_file(${CMAKE_SOURCE_DIR}/etc/postrm.in ${CMAKE_BINARY_DIR}/postrm @ONLY) configure_file(${CMAKE_SOURCE_DIR}/etc/upstart/maxscale.conf.in ${CMAKE_BINARY_DIR}/upstart/maxscale.conf @ONLY) -configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.cnf ${CMAKE_BINARY_DIR}/maxscale.cnf @ONLY) +configure_file(${CMAKE_SOURCE_DIR}/test/maxscale_test.cnf ${CMAKE_BINARY_DIR}/maxscale.cnf @ONLY) set(FLAGS "-Wall -Wno-unused-variable -Wno-unused-function -Werror -fPIC" CACHE STRING "Compilation flags") set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4" CACHE STRING "Debug compilation flags") diff --git a/server/core/test/rest-api/utils.js b/server/core/test/rest-api/utils.js index ac1ea3f03..6d9b3c156 100644 --- a/server/core/test/rest-api/utils.js +++ b/server/core/test/rest-api/utils.js @@ -423,7 +423,7 @@ module.exports = function() { this.host = "localhost:8989/v1" this.base_url = "http://" + this.host this.startMaxScale = function(done) { - child_process.execFile("./before.sh", function(err, stdout, stderr) { + child_process.execFile("./start_maxscale.sh", function(err, stdout, stderr) { if (process.env.MAXSCALE_DIR == null) { throw new Error("MAXSCALE_DIR is not set"); } @@ -432,7 +432,7 @@ module.exports = function() { }) }; this.stopMaxScale = function(done) { - child_process.execFile("./after.sh", function(err, stdout, stderr) { + child_process.execFile("./stop_maxscale.sh", function(err, stdout, stderr) { done() }) }; diff --git a/server/test/maxscale_test.cnf b/test/maxscale_test.cnf similarity index 91% rename from server/test/maxscale_test.cnf rename to test/maxscale_test.cnf index 16ae1718a..c62fc1892 100644 --- a/server/test/maxscale_test.cnf +++ b/test/maxscale_test.cnf @@ -1,11 +1,11 @@ [maxscale] threads=4 libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@ -logdir=@CMAKE_INSTALL_PREFIX@/ -datadir=@CMAKE_INSTALL_PREFIX@/ -cachedir=@CMAKE_INSTALL_PREFIX@/ +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=@CMAKE_INSTALL_PREFIX@/ +piddir=@CMAKE_INSTALL_PREFIX@/run/maxscale/ admin_auth=false [MySQL Monitor] diff --git a/test/run_npm_test.sh b/test/run_npm_test.sh index 8ea72ea37..97b2445ff 100755 --- a/test/run_npm_test.sh +++ b/test/run_npm_test.sh @@ -82,6 +82,9 @@ do echo "Done!" done +# Make sure no stale processes of files are left from an earlier run +./stop_maxscale.sh + # Run tests npm test rval=$? diff --git a/server/core/test/rest-api/before.sh b/test/start_maxscale.sh similarity index 100% rename from server/core/test/rest-api/before.sh rename to test/start_maxscale.sh diff --git a/server/core/test/rest-api/after.sh b/test/stop_maxscale.sh similarity index 75% rename from server/core/test/rest-api/after.sh rename to test/stop_maxscale.sh index 67af755ed..2933b88ba 100755 --- a/server/core/test/rest-api/after.sh +++ b/test/stop_maxscale.sh @@ -5,26 +5,24 @@ # and cleans up the directories that contain generated files. # -test -z "$MAXSCALE_DIR" && exit 1 - maxscaledir=$MAXSCALE_DIR -for ((i=0;i<10;i++)) +test -z "$MAXSCALE_DIR" && exit 1 + +for ((i=0;i<20;i++)) do - pkill maxscale || break + pkill '^maxscale$' || break sleep 0.5 done # If it wasn't dead before, now it is -pgrep maxscale && pkill -9 maxscale - -# Remove created users -rm $maxscaledir/passwd -rm $maxscaledir/maxadmin-users +pkill -9 '^maxscale$' rm -r $maxscaledir/lib/maxscale rm -r $maxscaledir/cache/maxscale rm -r $maxscaledir/run/maxscale +rm /tmp/maxadmin.sock + mkdir -m 0755 -p $maxscaledir/lib/maxscale mkdir -m 0755 -p $maxscaledir/cache/maxscale mkdir -m 0755 -p $maxscaledir/run/maxscale