diff --git a/lib/uplink-gomobile/test-sim-dev.sh b/lib/uplink-gomobile/test-sim-dev.sh new file mode 100755 index 000000000..802ec4d00 --- /dev/null +++ b/lib/uplink-gomobile/test-sim-dev.sh @@ -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 \ No newline at end of file diff --git a/scripts/postgres-dev.sh b/scripts/postgres-dev.sh new file mode 100755 index 000000000..821a5cf5e --- /dev/null +++ b/scripts/postgres-dev.sh @@ -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" \ No newline at end of file diff --git a/scripts/test-sim-backwards-dev.sh b/scripts/test-sim-backwards-dev.sh new file mode 100755 index 000000000..5e8ae4fbb --- /dev/null +++ b/scripts/test-sim-backwards-dev.sh @@ -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 \ No newline at end of file diff --git a/scripts/test-sim-dev.sh b/scripts/test-sim-dev.sh index 14a34e987..4de19cbbc 100755 --- a/scripts/test-sim-dev.sh +++ b/scripts/test-sim-dev.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 \ No newline at end of file