File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 66
77set -euxo pipefail
88
9+ fail_if_postgres_not_running () {
10+ containers=$( docker ps --filter " name=${container_name} " --quiet)
11+ if [ -z " ${containers} " ]; then
12+ echo " error: Docker container for PostgreSQL is not running"
13+ echo " error: Try running 'mise run postgres:up ${container_name} ' to start the container"
14+ exit 65
15+ fi
16+ }
17+
918POSTGRES_VERSION=${usage_postgres}
1019
1120connection_url=postgresql://${POSTGRES_USER:- $USER } :${POSTGRES_PASSWORD} @${POSTGRES_HOST} :${POSTGRES_PORT} /${POSTGRES_DB}
1221container_name=postgres-${POSTGRES_VERSION}
1322
23+ # Setup
24+ fail_if_postgres_not_running
25+
1426# Uninstall
1527cat release/cipherstash-encrypt-uninstall.sql | docker exec -i ${container_name} psql ${connection_url} -f-
1628
Original file line number Diff line number Diff line change @@ -10,12 +10,18 @@ set -euo pipefail
1010
1111POSTGRES_VERSION=${usage_postgres}
1212
13- mise run build
14- mise run reset --postgres ${POSTGRES_VERSION}
15-
1613connection_url=postgresql://${POSTGRES_USER:- $USER } :${POSTGRES_PASSWORD} @${POSTGRES_HOST} :${POSTGRES_PORT} /${POSTGRES_DB}
1714container_name=postgres-${POSTGRES_VERSION}
1815
16+ fail_if_postgres_not_running () {
17+ containers=$( docker ps --filter " name=${container_name} " --quiet)
18+ if [ -z " ${containers} " ]; then
19+ echo " error: Docker container for PostgreSQL is not running"
20+ echo " error: Try running 'mise run postgres:up ${container_name} ' to start the container"
21+ exit 65
22+ fi
23+ }
24+
1925run_test () {
2026 echo
2127 echo ' ###############################################'
@@ -25,6 +31,11 @@ run_test () {
2531 cat $1 | docker exec -i ${container_name} psql $connection_url -f-
2632}
2733
34+ # setup
35+ fail_if_postgres_not_running
36+ mise run build
37+ mise run reset --postgres ${POSTGRES_VERSION}
38+
2839# tests
2940run_test tests/core.sql
3041run_test tests/core-functions.sql
You can’t perform that action at this time.
0 commit comments