Skip to content

Commit

Permalink
WIPWIP
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Aug 18, 2023
1 parent abff8b9 commit 4825f2d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 39 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/dmr-test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ permissions:
jobs:
end_to_end:
runs-on: ubuntu-latest
# services:
# postgres:
# image: postgres:13-alpine
# env:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: syncv3
# ports:
# - 5432:5432
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: syncv3
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# - uses: actions/checkout@v3
#
# - name: Install Go
# uses: actions/setup-go@v4
# with:
# go-version: 1.19
#
# - name: Build
# run: go build ./cmd/syncv3
#
# - name: Set up gotestfmt
# uses: GoTestTools/gotestfmt-action@v2
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.19

- name: Build
run: go build ./cmd/syncv3

- name: Set up gotestfmt
uses: GoTestTools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Declare Python dependencies
run: echo "matrix-synapse==1.90.0" > requirements.txt
Expand Down Expand Up @@ -78,21 +78,21 @@ jobs:
- name: Run end-to-end tests
run: |
set -euo pipefail
./run-tests.sh -count=1 -v -json . 2>&1 | tee test-e2e-runner.log | gotestfmt -hide all
./run-tests-dmr-test.sh -count=1 -v -json . 2>&1 | tee test-e2e-runner.log | gotestfmt -hide all
working-directory: tests-e2e
shell: bash
env:
SYNCV3_DB: user=postgres dbname=syncv3 sslmode=disable password=postgres host=localhost
SYNCV3_SERVER: http://localhost:8008
SYNCV3_SECRET: itsasecret
E2E_TEST_SERVER_STDOUT: test-e2e-server.log
#
# - name: Upload test log
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: E2E test logs
# path: |
# ./tests-e2e/test-e2e-runner.log
# ./tests-e2e/test-e2e-server.log
# if-no-files-found: error
- name: Upload test log
uses: actions/upload-artifact@v3
if: always()
with:
name: E2E test logs
path: |
./tests-e2e/test-e2e-runner.log
./tests-e2e/test-e2e-server.log
if-no-files-found: error
25 changes: 25 additions & 0 deletions tests-e2e/run-tests-dmr-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -eu
export SYNCV3_BINDADDR=0.0.0.0:8844
export SYNCV3_ADDR='http://localhost:8844'
export SYNCV3_DEBUG=1

# Run synapse and stop it afterwards.
python -m synapse.app.homeserver -c synapse/homeserver.yaml &
SYNAPSE_PID=$!

# Run the binary and stop it afterwards.
# Direct stderr into stdout, and optionally redirect both to a file.
../syncv3 &> "${E2E_TEST_SERVER_STDOUT:-/dev/stdout}" &
SYNCV3_PID=$!
trap "kill $SYNCV3_PID; kill $SYNAPSE_PID" EXIT

# wait for the server to be listening, we want this endpoint to 404 instead of connrefused
until [ \
"$(curl -s -w '%{http_code}' -o /dev/null "http://localhost:8844/idonotexist")" \
-eq 404 ]
do
echo 'Waiting for server to start...'
sleep 1
done

go test "$@"

0 comments on commit 4825f2d

Please sign in to comment.