memgraph/tests/drivers/run.sh
antonio2368 0bcc1d67bc
Add support for Bolt v4(.1) (#10)
* Added handshake support
* Add support for v4 hello and goodbye
* Add support for pulling n results
* Add support for transactions
* Add pull n for the dump
* Add support for NOOP
* Add support for multiple queries
* Update bolt session to support qid
* Update drivers test with multiple versions and go
* Extract failure handling into a function
* Use unique ptr instead of optional for query execution
* Destroy stream before query execution

Co-authored-by: Antonio Andelic <antonio.andelic@memgraph.io>
2020-10-16 12:49:33 +02:00

82 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
pushd () { command pushd "$@" > /dev/null; }
popd () { command popd "$@" > /dev/null; }
function wait_for_server {
port=$1
while ! nc -z -w 1 127.0.0.1 $port; do
sleep 0.1
done
sleep 1
}
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
# Create a temporary directory.
tmpdir=/tmp/memgraph_drivers
if [ -d $tmpdir ]; then
rm -rf $tmpdir
fi
mkdir -p $tmpdir
# Find memgraph binaries.
binary_dir="$DIR/../../build"
# Start memgraph.
$binary_dir/memgraph \
--data-directory=$tmpdir \
--query-execution-timeout-sec=5 \
--bolt-session-inactivity-timeout=10 \
--bolt-cert-file="" \
--bolt-server-name-for-init="Neo4j/1.1" \
--min-log-level 1 &
pid=$!
wait_for_server 7687
# Run all available tests
code_test=0
for i in *; do
if [ ! -d $i ]; then continue; fi
pushd $i
echo "Running: $i"
# run all versions
for v in *; do
if [ ! -d $v ]; then continue; fi
pushd $v
echo "Running version: $v"
./run.sh
code_test=$?
if [ $code_test -ne 0 ]; then
echo "FAILED: $i"
break
fi
popd
done;
echo
popd
done
# Stop memgraph.
kill $pid
wait $pid
code_mg=$?
# Temporary directory cleanup.
if [ -d $tmpdir ]; then
rm -rf $tmpdir
fi
# Check memgraph exit code.
if [ $code_mg -ne 0 ]; then
echo "The memgraph process didn't terminate properly!"
exit $code_mg
fi
# Check test exit code.
if [ $code_test -ne 0 ]; then
echo "One of the tests failed!"
exit $code_test
fi