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:
@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# This script is run after each test block. It kills the MaxScale process
|
||||
# and cleans up the directories that contain generated files.
|
||||
#
|
||||
|
||||
test -z "$MAXSCALE_DIR" && exit 1
|
||||
|
||||
maxscaledir=$MAXSCALE_DIR
|
||||
|
||||
for ((i=0;i<10;i++))
|
||||
do
|
||||
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
|
||||
|
||||
rm -r $maxscaledir/lib/maxscale
|
||||
rm -r $maxscaledir/cache/maxscale
|
||||
rm -r $maxscaledir/run/maxscale
|
||||
mkdir -m 0755 -p $maxscaledir/lib/maxscale
|
||||
mkdir -m 0755 -p $maxscaledir/cache/maxscale
|
||||
mkdir -m 0755 -p $maxscaledir/run/maxscale
|
||||
@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# This script is run before each test block. It starts MaxScale and waits for it
|
||||
# to become responsive.
|
||||
#
|
||||
|
||||
maxscaledir=$MAXSCALE_DIR
|
||||
|
||||
test -z "$MAXSCALE_DIR" && exit 1
|
||||
|
||||
# Start MaxScale
|
||||
$maxscaledir/bin/maxscale -df $maxscaledir/maxscale.cnf >& $maxscaledir/maxscale.output &
|
||||
pid=$!
|
||||
|
||||
# Wait for MaxScale to start
|
||||
for ((i=0;i<60;i++))
|
||||
do
|
||||
$maxscaledir/bin/maxadmin help >& /dev/null && break
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
# Give MaxScale some time to settle
|
||||
sleep 1
|
||||
@ -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()
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user