Skip to content

Commit

Permalink
Use host network in github action
Browse files Browse the repository at this point in the history
  • Loading branch information
iainsproat committed Sep 5, 2024
1 parent 50f3eb8 commit de3eca2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/preview-service-acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
OUTPUT_FILE_PATH: /tmp/preview-service-output.png
NODE_ENV: test
PG_CONNECTION_STRING: postgres://preview_service_test:preview_service_test@localhost:5432/preview_service_test
DOCKER_PG_CONNECTION_STRING: postgres://preview_service_test:preview_service_test@postgres:5432/preview_service_test
IS_HOST_NETWORK: 'true'

- uses: actions/upload-artifact@v4
name: Upload the output from the preview-service
Expand Down
4 changes: 3 additions & 1 deletion packages/preview-service/tests/acceptance/acceptance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ describe.sequential('Acceptance', () => {
beforeEach(() => {
const dbName = inject('dbName')
const pgConnString =
process.env.DOCKER_PG_CONNECTION_STRING ||
process.env.PG_CONNECTION_STRING ||
`postgres://preview_service_test:[email protected]:5432/${dbName}`
const isHostNetwork = process.env.IS_HOST_NETWORK === 'true'
//purposefully running in the background without waiting
void runProcess('docker', [
'run',
isHostNetwork ? '--network="host"' : '',
'--env',
`PG_CONNECTION_STRING=${pgConnString}`,
'--rm',
Expand Down

0 comments on commit de3eca2

Please sign in to comment.