scripts: use postgres script with all tests (#3404)
This commit is contained in:
parent
015350e230
commit
acc7b116aa
7
lib/uplink-gomobile/test-sim-dev.sh
Executable file
7
lib/uplink-gomobile/test-sim-dev.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
source $SCRIPTDIR/../../scripts/postgres-dev.sh
|
||||
|
||||
$SCRIPTDIR/test-sim.sh
|
25
scripts/postgres-dev.sh
Executable file
25
scripts/postgres-dev.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
LOG_FILE=${STORJ_SIM_POSTGRES_LOG:-"storj-sim-postgres.log"}
|
||||
CONTAINER_NAME=storj_sim_postgres
|
||||
|
||||
cleanup(){
|
||||
docker rm -f $CONTAINER_NAME
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
docker run --rm -d -p 5433:5432 --name $CONTAINER_NAME postgres:9.6 -c log_min_duration_statement=0
|
||||
docker logs -f $CONTAINER_NAME > $LOG_FILE 2>&1 &
|
||||
|
||||
STORJ_SIM_DATABASE=${STORJ_SIM_DATABASE:-"teststorj"}
|
||||
|
||||
RETRIES=10
|
||||
|
||||
until docker exec $CONTAINER_NAME psql -h localhost -U postgres -d postgres -c "select 1" > /dev/null 2>&1 || [ $RETRIES -eq 0 ]; do
|
||||
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
docker exec $CONTAINER_NAME psql -h localhost -U postgres -c "create database $STORJ_SIM_DATABASE;"
|
||||
|
||||
export STORJ_SIM_POSTGRES="postgres://postgres@localhost:5433/$STORJ_SIM_DATABASE?sslmode=disable"
|
7
scripts/test-sim-backwards-dev.sh
Executable file
7
scripts/test-sim-backwards-dev.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
source $SCRIPTDIR/postgres-dev.sh
|
||||
|
||||
$SCRIPTDIR/test-sim-backwards.sh
|
@ -2,28 +2,6 @@
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
LOG_FILE=${STORJ_SIM_POSTGRES_LOG:-"storj-sim-postgres.log"}
|
||||
CONTAINER_NAME=storj_sim_postgres
|
||||
|
||||
cleanup(){
|
||||
docker rm -f $CONTAINER_NAME
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
docker run --rm -d -p 5433:5432 --name $CONTAINER_NAME postgres:9.6 -c log_min_duration_statement=0
|
||||
docker logs -f $CONTAINER_NAME > $LOG_FILE 2>&1 &
|
||||
|
||||
STORJ_SIM_DATABASE=${STORJ_SIM_DATABASE:-"teststorj"}
|
||||
|
||||
RETRIES=10
|
||||
|
||||
until docker exec $CONTAINER_NAME psql -h localhost -U postgres -d postgres -c "select 1" > /dev/null 2>&1 || [ $RETRIES -eq 0 ]; do
|
||||
echo "Waiting for postgres server, $((RETRIES--)) remaining attempts..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
docker exec $CONTAINER_NAME psql -h localhost -U postgres -c "create database $STORJ_SIM_DATABASE;"
|
||||
|
||||
export STORJ_SIM_POSTGRES="postgres://postgres@localhost:5433/$STORJ_SIM_DATABASE?sslmode=disable"
|
||||
source $SCRIPTDIR/postgres-dev.sh
|
||||
|
||||
$SCRIPTDIR/test-sim.sh
|
Loading…
Reference in New Issue
Block a user