Skip to content

Commit

Permalink
The "test" subdirectory removes the need for another sub-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
justinclift committed Jul 8, 2023
1 parent 625771a commit 31d9fe6
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pgstuff
test
7 changes: 1 addition & 6 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/usr/bin/env bash

# Create a sub-directory to hold the PG data, due to a really silly Docker bug that they're ignoring
if [ ! -d pgstuff ]; then
mkdir pgstuff
fi

# Start the docker container
docker run --name pgauto -it --rm -e POSTGRES_PASSWORD=password --mount type=bind,source=$(pwd)/pgstuff/postgres-data,target=/var/lib/postgresql/data pgautoupgrade:latest
docker run --name pgauto -it --rm -e POSTGRES_PASSWORD=password --mount type=bind,source=$(pwd)/postgres-data,target=/var/lib/postgresql/data pgautoupgrade:latest
6 changes: 3 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ test_run() {
V=$1

# Delete any existing test PostgreSQL data
if [ -d pgstuff/postgres-data ]; then
if [ -d postgres-data ]; then
echo "Removing old PostgreSQL data from test directory"
sudo rm -rf pgstuff/postgres-data
sudo rm -rf postgres-data
fi

# Create the PostgreSQL database using PG 9.5
Expand All @@ -21,7 +21,7 @@ test_run() {
docker-compose -f docker-compose-pgauto.yml up -d

# Verify the PostgreSQL data files are now version 15
PGVER=$(sudo cat pgstuff/postgres-data/PG_VERSION)
PGVER=$(sudo cat postgres-data/PG_VERSION)
if [ "$PGVER" != "15" ]; then
echo
echo "***************************************************************"
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pg10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: postgres:10-alpine
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pg11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: postgres:11-alpine
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pg12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: postgres:12-alpine
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pg13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: postgres:13-alpine
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pg14.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: postgres:14-alpine
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pg9.5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: postgres:9.5-alpine
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pg9.6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: postgres:9.6-alpine
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down
2 changes: 1 addition & 1 deletion test/docker-compose-pgauto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
image: pgautoupgrade:latest
env_file: .env
volumes:
- ./pgstuff/postgres-data:/var/lib/postgresql/data
- ./postgres-data:/var/lib/postgresql/data
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
Expand Down

0 comments on commit 31d9fe6

Please sign in to comment.