Merge pull request #1628 from input-output-hk/stop_postgres
Stop postgres if started during testing
Stop postgres if started during testing
# stop all running cluster instances
stop_instances "$WORKDIR"
# stop postgres if running
stop_postgres || true
# prepare artifacts for upload in Github Actions
if [ -n "${GITHUB_ACTIONS:-""}" ]; then
# create results archive
echo "::group::db-sync setup"
TEST_THREADS="${TEST_THREADS:-15}"
CLUSTERS_COUNT="${CLUSTERS_COUNT:-5}"
export TEST_THREADS CLUSTERS_COUNT
pushd "$WORKDIR" || exit 1
stop_postgres() {
local psql_pid_file="$WORKDIR/postgres/postgres.pid"
if [ ! -f "$psql_pid_file" ]; then
return 0
fi
local psql_pid
psql_pid="$(<"$psql_pid_file")"
for _ in {1..5}; do
if ! kill "$psql_pid"; then
break
fi
sleep 1
if [ ! -f "$psql_pid_file" ]; then
break
fi
done
rm -f "$psql_pid_file"
}
# clone db-sync if needed
if [ ! -e cardano-db-sync ]; then
git clone https://github.com/input-output-hk/cardano-db-sync.git
# start postgres
postgres -D "$POSTGRES_DIR/data" -k "$POSTGRES_DIR" > "$POSTGRES_DIR/postgres.log" 2>&1 &
PSQL_PID="$!"
echo "$PSQL_PID" > "$POSTGRES_DIR/postgres.pid"
sleep 5
cat "$POSTGRES_DIR/postgres.log"
echo
Signed-off-by: Chris Gianelloni <[email protected]>
- Update readme to address issues and questions presented by CPS-0001 - Update CDDL to support a more flexible scoping structure for future expansion