2018-07-10 13:01:02 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
CONSOLE_ROOT="${BASH_SOURCE[0]%/*}/../console"
|
|
|
|
|
2018-07-11 09:47:51 +03:00
|
|
|
wait_for_port() {
|
|
|
|
local PORT=$1
|
|
|
|
echo "waiting for $PORT"
|
|
|
|
for i in `seq 1 60`;
|
|
|
|
do
|
|
|
|
nc -z localhost $PORT && echo "port $PORT is ready" && return
|
|
|
|
echo -n .
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo "Failed waiting for $PORT" && exit 1
|
|
|
|
}
|
|
|
|
|
2018-07-10 13:01:02 +03:00
|
|
|
cd "$CONSOLE_ROOT"
|
|
|
|
|
|
|
|
mkdir -p /build/_console_output
|
|
|
|
touch /build/_console_output/server.log
|
|
|
|
touch /build/_console_output/cli.log
|
|
|
|
|
|
|
|
# start graphql-engine
|
|
|
|
/build/_server_output/graphql-engine \
|
|
|
|
--database-url postgres://gql_test@localhost:5432/gql_test serve > /build/_console_output/server.log 2>&1 &
|
|
|
|
|
2018-07-11 09:47:51 +03:00
|
|
|
wait_for_port 8080
|
|
|
|
|
2018-07-10 13:01:02 +03:00
|
|
|
# start cli
|
2018-07-17 20:00:26 +03:00
|
|
|
/build/_cli_output/binaries/cli-hasura-linux-amd64 init --directory gql-test && cd gql-test
|
|
|
|
/build/_cli_output/binaries/cli-hasura-linux-amd64 console --no-browser > /build/_console_output/cli.log 2>&1 &
|
2018-07-10 13:01:02 +03:00
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
2018-07-11 09:47:51 +03:00
|
|
|
wait_for_port 9693
|
|
|
|
|
2018-07-10 13:01:02 +03:00
|
|
|
export PORT=3000
|
|
|
|
export NODE_ENV=development
|
|
|
|
export DATA_API_URL=http://localhost:8080
|
|
|
|
export API_HOST=http://localhost
|
|
|
|
export API_PORT=9693
|
|
|
|
export CONSOLE_MODE=cli
|
|
|
|
export DEV_DATA_API_URL=http://localhost:8080
|
|
|
|
export URL_PREFIX=/
|
|
|
|
|
|
|
|
# test console
|
|
|
|
npm run dev &
|
2018-09-08 20:31:14 +03:00
|
|
|
# wait for console to build
|
2019-01-15 08:19:06 +03:00
|
|
|
while [ ! -f ./webpack-assets.json ]
|
|
|
|
do
|
|
|
|
sleep 2
|
|
|
|
done
|
2018-09-08 20:31:14 +03:00
|
|
|
# run console tests
|
2018-07-17 20:00:26 +03:00
|
|
|
npm run test
|