Skip to content

Commit df4de31

Browse files
committed
refactor(tests): remove orchestration from go integration tests
Move proxy and postgres setup from individual golang test script to main integration task to avoid duplication and improve maintainability. - Remove postgres/proxy startup from golang.sh - now handled centrally - Add host.docker.internal mapping to docker-compose for host connectivity - Use CS_PROXY__HOST variable for connection URL configuration - Consolidate test orchestration in main integration task
1 parent 73c35df commit df4de31

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.github/actions/setup-test/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ runs:
1414
- name: Setup Rust cache
1515
uses: Swatinem/rust-cache@v2
1616
with:
17-
cache-provider: ${{ inputs.provider }}
18-
shared-key: ${{ inputs.key }}
1917
cache-all-crates: true
18+
- name: Set up Docker Compose
19+
uses: docker/setup-compose-action@v1
20+
with:
21+
version: latest
2022
- uses: jdx/mise-action@v2
2123
with:
2224
version: 2025.1.0 # [default: latest] mise version to install

mise.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ CS_DATABASE__PORT = "5532"
2828
# CS_DATABASE__PORT = "5617"
2929

3030
# Default configuration for dev cipherstash-proxy run using 'mise run proxy:up'
31-
CS_PROXY__HOST = "proxy"
31+
# CS_PROXY__HOST = "proxy"
32+
CS_PROXY__HOST = "host.docker.internal"
33+
3234
# Misc
3335
DOCKER_CLI_HINTS = "false" # Please don't show us What's Next.
3436

@@ -387,7 +389,14 @@ echo '###############################################'
387389
echo '# Test: Language-specific integration'
388390
echo '###############################################'
389391
echo
392+
393+
mise --env tls run postgres:up --extra-args "--detach --wait"
394+
mise --env tls run postgres:setup
395+
mise --env tls run proxy:down proxy-tls
396+
mise --env tls run proxy:up --extra-args "--detach --wait"
397+
390398
mise run test:integration:lang:golang
399+
391400
mise run test:integration:lang:python
392401
393402
# Commented out pending fix of the root cause of the test flake

tests/docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ services:
7171
- CS_LOG__CONTEXT_LEVEL=${CS_LOG__CONTEXT_LEVEL:-debug}
7272
networks:
7373
- postgres
74+
extra_hosts:
75+
- host.docker.internal:host-gateway
7476
deploy:
7577
resources:
7678
limits:
@@ -114,6 +116,8 @@ services:
114116
- ./tls/server.key:/etc/cipherstash-proxy/server.key
115117
networks:
116118
- postgres
119+
extra_hosts:
120+
- host.docker.internal:host-gateway
117121

118122
python:
119123
image: test/python

tests/tasks/test/integration/lang/golang.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55

66
set -e
77

8-
mise --env tls run postgres:up --extra-args "--detach --wait"
9-
mise --env tls run postgres:setup
10-
mise --env tls run proxy:down proxy-tls
11-
mise --env tls run proxy:up --extra-args "--detach --wait"
128

139
source "$(dirname "${BASH_SOURCE[0]}")/../url_encode.sh"
1410

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

1713
connection_url=postgresql://${CS_DATABASE__USERNAME}:${encoded_password}@proxy:6432/${CS_DATABASE__NAME}
14+
1815
network_id=$(docker network ls --filter name=tests_postgres --quiet)
1916
platform="linux/$(uname -m | sed 's/x86_64/amd64/')"
2017

0 commit comments

Comments
 (0)