Skip to content

Commit 32049f8

Browse files
committed
Run psql inside containers
And use idiomatic postgres environment variable names
1 parent 6e6c733 commit 32049f8

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

mise.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ includes = [
1313
]
1414

1515
[env]
16-
# Default configuration for running cipherstash-proxy out of the box
17-
# CS_DATABASE__NAME = "cipherstash"
18-
# CS_DATABASE__USERNAME = "cipherstash"
19-
# CS_DATABASE__PASSWORD = "password"
20-
# CS_DATABASE__HOST = "localhost"
21-
# CS_DATABASE__PORT = "5532"
16+
POSTGRES_DB = "cipherstash"
17+
POSTGRES_USER = "cipherstash"
18+
POSTGRES_PASSWORD = "password"
19+
POSTGRES_HOST = "localhost"
20+
POSTGRES_PORT = "5532"

tasks/reset.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
set -euxo pipefail
55

6-
connection_url=postgresql://${CS_DATABASE__USERNAME:-$USER}:${CS_DATABASE__PASSWORD}@localhost:$CS_DATABASE__PORT/$CS_DATABASE__NAME
6+
connection_url=postgresql://${POSTGRES_USER:-$USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
7+
container_name=postgres-${POSTGRES_VERSION}
78

89
# Uninstall
9-
psql ${connection_url} -f release/cipherstash-encrypt-uninstall.sql
10+
cat release/cipherstash-encrypt-uninstall.sql | docker exec -i ${container_name} psql ${connection_url} -f-
1011

1112
# Install
12-
psql ${connection_url} -f release/cipherstash-encrypt.sql
13+
cat release/cipherstash-encrypt.sql | docker exec -i ${container_name} psql ${connection_url} -f-

tasks/test.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ set -euxo pipefail
88
mise run build
99
mise run reset
1010

11-
connection_url=postgresql://${CS_DATABASE__USERNAME:-$USER}:@localhost:$CS_DATABASE__PORT/$CS_DATABASE__NAME
11+
connection_url=postgresql://${POSTGRES_USER:-$USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
12+
container_name=postgres-${POSTGRES_VERSION}
1213

1314
# # tests
1415
# PGPASSWORD=$CS_DATABASE__PASSWORD psql $connection_url -f tests/core.sql
1516
# PGPASSWORD=$CS_DATABASE__PASSWORD psql $connection_url -f tests/core-functions.sql
1617
# PGPASSWORD=$CS_DATABASE__PASSWORD psql $connection_url -f tests/config.sql
1718
# PGPASSWORD=$CS_DATABASE__PASSWORD psql $connection_url -f tests/encryptindex.sql
18-
PGPASSWORD=$CS_DATABASE__PASSWORD psql $connection_url -f tests/operators.sql
19+
cat tests/operators.sql | docker exec -i ${container_name} psql ${connection_url} -f-

0 commit comments

Comments
 (0)