Refactor REST API test script into a npm test framework
The script can now be used to run an arbitrary set of Node.js tests as long as they define the `test` npm target. Refactored REST API tests to fit into this framework.
This commit is contained in:
parent
01fa1a827a
commit
173a97ae70
@ -1,3 +1,6 @@
|
||||
add_custom_target(test_rest_api
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test_rest_api.sh ${CMAKE_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/test/run_npm_test.sh
|
||||
${CMAKE_SOURCE_DIR} # Path to MaxScale sources
|
||||
${CMAKE_CURRENT_SOURCE_DIR} # Path to test sources
|
||||
${CMAKE_BINARY_DIR}/rest-api/ # Location where tests are built and run
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
@ -1,22 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script builds and installs MaxScale, starts a MaxScale instance, runs the
|
||||
# tests use npm and stops MaxScale.
|
||||
# This script builds and installs MaxScale, starts a MariaDB cluster and runs any
|
||||
# tests that define a `npm test` target
|
||||
#
|
||||
# This is definitely not the most efficient way to test the binaries but it's a
|
||||
# guaranteed method of creating a consistent and "safe" testing environment.
|
||||
#
|
||||
# TODO: Install and start a local MariaDB server for testing purposes
|
||||
|
||||
if [ $# -lt 3 ]
|
||||
then
|
||||
echo "USAGE: $0 <MaxScale sources> <test sources> <test directory>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
srcdir=$1
|
||||
maxscaledir=$PWD/maxscale_test/
|
||||
testdir=$PWD/local_test/
|
||||
testsrc=$2
|
||||
testdir=$3
|
||||
|
||||
maxscaledir=$PWD/maxscale_test/
|
||||
|
||||
# Create the test directory
|
||||
mkdir -p $testdir && cd $testdir
|
||||
|
||||
# Currently all tests that use npm are for the REST API
|
||||
cp -t $testdir -r $srcdir/server/core/test/rest-api/*
|
||||
# Copy the common test files (docker-compose.yml etc.)
|
||||
cp -t $testdir -r $srcdir/test/*
|
||||
|
||||
# Copy test sources to test workspace
|
||||
cp -t $testdir -r $testsrc/*
|
||||
|
||||
# Bring MariaDB servers up, this is an asynchronous process
|
||||
docker-compose up -d || exit 1
|
Loading…
x
Reference in New Issue
Block a user