Move REST API test scripts into a common directory

Moved and renamed the starting and stopping scripts from the REST API
tests to a common directory. This way the MaxCtrl tests can use the same
scripts to start and stop MaxScale.

Also moved the test configuration file into the `test/` directory and
changed some of the default directory locations.
This commit is contained in:
Markus Mäkelä
2017-07-13 17:09:31 +03:00
parent 173a97ae70
commit 67b2654f50
6 changed files with 17 additions and 16 deletions

View File

@ -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/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/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}/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(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") set(DEBUG_FLAGS "-ggdb -pthread -pipe -Wformat -fstack-protector --param=ssp-buffer-size=4" CACHE STRING "Debug compilation flags")

View File

@ -423,7 +423,7 @@ module.exports = function() {
this.host = "localhost:8989/v1" this.host = "localhost:8989/v1"
this.base_url = "http://" + this.host this.base_url = "http://" + this.host
this.startMaxScale = function(done) { 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) { if (process.env.MAXSCALE_DIR == null) {
throw new Error("MAXSCALE_DIR is not set"); throw new Error("MAXSCALE_DIR is not set");
} }
@ -432,7 +432,7 @@ module.exports = function() {
}) })
}; };
this.stopMaxScale = function(done) { this.stopMaxScale = function(done) {
child_process.execFile("./after.sh", function(err, stdout, stderr) { child_process.execFile("./stop_maxscale.sh", function(err, stdout, stderr) {
done() done()
}) })
}; };

View File

@ -1,11 +1,11 @@
[maxscale] [maxscale]
threads=4 threads=4
libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@ libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@
logdir=@CMAKE_INSTALL_PREFIX@/ logdir=@CMAKE_INSTALL_PREFIX@/log/maxscale/
datadir=@CMAKE_INSTALL_PREFIX@/ datadir=@CMAKE_INSTALL_PREFIX@/lib/maxscale
cachedir=@CMAKE_INSTALL_PREFIX@/ cachedir=@CMAKE_INSTALL_PREFIX@/cache/maxscale
language=@CMAKE_INSTALL_PREFIX@/lib/maxscale/ language=@CMAKE_INSTALL_PREFIX@/lib/maxscale/
piddir=@CMAKE_INSTALL_PREFIX@/ piddir=@CMAKE_INSTALL_PREFIX@/run/maxscale/
admin_auth=false admin_auth=false
[MySQL Monitor] [MySQL Monitor]

View File

@ -82,6 +82,9 @@ do
echo "Done!" echo "Done!"
done done
# Make sure no stale processes of files are left from an earlier run
./stop_maxscale.sh
# Run tests # Run tests
npm test npm test
rval=$? rval=$?

View File

@ -5,26 +5,24 @@
# and cleans up the directories that contain generated files. # and cleans up the directories that contain generated files.
# #
test -z "$MAXSCALE_DIR" && exit 1
maxscaledir=$MAXSCALE_DIR maxscaledir=$MAXSCALE_DIR
for ((i=0;i<10;i++)) test -z "$MAXSCALE_DIR" && exit 1
for ((i=0;i<20;i++))
do do
pkill maxscale || break pkill '^maxscale$' || break
sleep 0.5 sleep 0.5
done done
# If it wasn't dead before, now it is # If it wasn't dead before, now it is
pgrep maxscale && pkill -9 maxscale pkill -9 '^maxscale$'
# Remove created users
rm $maxscaledir/passwd
rm $maxscaledir/maxadmin-users
rm -r $maxscaledir/lib/maxscale rm -r $maxscaledir/lib/maxscale
rm -r $maxscaledir/cache/maxscale rm -r $maxscaledir/cache/maxscale
rm -r $maxscaledir/run/maxscale rm -r $maxscaledir/run/maxscale
rm /tmp/maxadmin.sock
mkdir -m 0755 -p $maxscaledir/lib/maxscale mkdir -m 0755 -p $maxscaledir/lib/maxscale
mkdir -m 0755 -p $maxscaledir/cache/maxscale mkdir -m 0755 -p $maxscaledir/cache/maxscale
mkdir -m 0755 -p $maxscaledir/run/maxscale mkdir -m 0755 -p $maxscaledir/run/maxscale