Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,46 @@ echo
mise --env tcp run postgres:setup
mise --env tls run postgres:setup

echo
echo '###############################################'
echo '# Test: Prometheus'
echo '###############################################'
echo

mise --env tcp run proxy:up proxy --extra-args "--detach --wait"
mise --env tcp run test:wait_for_postgres_to_quack --port 6432 --max-retries 20
mise --env tcp run test:integration:prometheus
mise --env tcp run proxy:down

echo
echo '###############################################'
echo '# Test: non-TLS'
echo '###############################################'
echo

mise --env tcp run proxy:up proxy --extra-args "--detach --wait"
mise --env tcp run test:wait_for_postgres_to_quack --port 6432 --max-retries 20
mise --env tcp run test:integration:psql-tcp
mise --env tcp run proxy:down

echo
echo '###############################################'
echo '# Test: TLS'
echo '###############################################'
echo

mise --env tls run proxy:up proxy-tls --extra-args "--detach --wait"
mise --env tls run test:wait_for_postgres_to_quack --port 6432 --max-retries 20 --tls
mise --env tls run test:integration:psql-tls
mise --env tls run proxy:down


echo
echo '###############################################'
echo '# Test: Integration'
echo '###############################################'
echo

mise --env tls e
mise --env tls run proxy:up proxy-tls --extra-args "--detach --wait"
mise --env tls run test:wait_for_postgres_to_quack --port 6432 --max-retries 20 --tls
cargo nextest run --no-fail-fast --nocapture -E 'package(cipherstash-proxy-integration)'
Expand Down
6 changes: 3 additions & 3 deletions tests/tasks/test/integration/psql-tcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -x
source "$(dirname "${BASH_SOURCE[0]}")/url_encode.sh"

encoded_password=$(urlencode "${CS_DATABASE__PASSWORD}")

echo "Encoded password: ${encoded_password}"

# sanity check direct connections
docker exec -i postgres${CONTAINER_SUFFIX} psql postgresql://${CS_DATABASE__USERNAME}:${encoded_password}@${CS_DATABASE__HOST}:${CS_DATABASE__PORT}/cipherstash <<-EOF
Expand All @@ -22,13 +22,13 @@ SELECT 1;
EOF

# Connect to the proxy
docker exec -i postgres psql 'postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash' <<-EOF
docker exec -i postgres psql postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash <<-EOF
SELECT 1;
EOF

# Attempt with TLS
set +e
docker exec -i postgres psql 'postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash?sslmode=require' <<-EOF
docker exec -i postgres psql postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash?sslmode=require <<-EOF
SELECT 1;
EOF
if [ $? -eq 0 ]; then
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/test/integration/psql-tls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ SELECT 1;
EOF

# Connect to the proxy forcing TLS
docker exec -i postgres${CONTAINER_SUFFIX} psql 'postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash?sslmode=require' <<-EOF
docker exec -i postgres${CONTAINER_SUFFIX} psql postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash?sslmode=require <<-EOF
SELECT 1;
EOF

# Connect without TLS
set +e
OUTPUT="$(docker exec -i postgres${CONTAINER_SUFFIX} psql 'postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash?sslmode=disable' --command 'SELECT 1' 2>&1)"
OUTPUT="$(docker exec -i postgres${CONTAINER_SUFFIX} psql postgresql://cipherstash:${encoded_password}@proxy:6432/cipherstash?sslmode=disable --command 'SELECT 1' 2>&1)"
retval=$?
if echo ${OUTPUT} | grep -v 'Transport Layer Security (TLS) connection is required'; then
echo "error: did not see string in output: \"Transport Layer Security (TLS) connection is required\""
Expand Down