Skip to content

Commit

Permalink
CI/CD: add jobs for client_integration_test
Browse files Browse the repository at this point in the history
  • Loading branch information
ivard committed Aug 30, 2023
1 parent ab3f743 commit ad38759
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 1 deletion.
75 changes: 75 additions & 0 deletions .github/actions/integration-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Integration test
description: Runs the tests in ./internal/sessiontest/client_integration_test.go against the given IRMA server and keyshare server artifacts.
inputs:
test-ref:
description: The branch, tag or SHA to check out the tests from
required: true
irma-server-artifact:
description: Artifact url or id of the irma server artifact to use
required: true
keyshare-server-artifact:
description: Artifact url or id of the keyshare server artifact to use
required: true
runs:
using: composite
steps:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ^1.18

- name: Download IRMA server artifact (url)
if: startsWith(inputs.irma-server-artifact, 'https://')
run: curl --create-dirs -L -o ./bin-is/irma-linux-amd64 ${{ inputs.irma-server-artifact }}
shell: bash

- name: Download IRMA server artifact (artifact id)
if: ${{ !startsWith(inputs.irma-server-artifact, 'https://') }}
uses: actions/download-artifact@v2
with:
name: ${{ inputs.irma-server-artifact }}
path: bin-is

- name: Set file permissions for bin-is
run: chmod +x ./bin-is/irma-linux-amd64
shell: bash

- name: Download keyshare server artifact (url)
if: startsWith(inputs.keyshare-server-artifact, 'https://')
run: curl --create-dirs -L -o ./bin-ks/irma-linux-amd64 ${{ inputs.keyshare-server-artifact }}
shell: bash

- name: Download keyshare server artifact (artifact id)
if: ${{ !startsWith(inputs.keyshare-server-artifact, 'https://') }}
uses: actions/download-artifact@v2
with:
name: ${{ inputs.keyshare-server-artifact }}
path: bin-ks

- name: Set file permissions for bin-ks
run: chmod +x ./bin-ks/irma-linux-amd64
shell: bash

- name: Run keyshare server utilities
run: docker-compose up -d
shell: bash

# We add & at the end of each command to run them in the background.
- name: Run IRMA server
run: ./bin-is/irma-linux-amd64 server -s testdata/irma_configuration --url http://localhost:port -p 48682 -k testdata/privatekeys &
shell: bash

- name: Run keyshare server
run: ./bin-ks/irma-linux-amd64 keyshare server -c testdata/configurations/keyshareserver.yml &
shell: bash

- name: Checkout test code
uses: actions/checkout@v3
with:
ref: ${{ inputs.test-ref }}
path: irmago_test_checkout

- name: Run integration tests
working-directory: irmago_test_checkout
run: go test -v --tags=integration_tests -run TestClientIntegration -p 1 ./...
shell: bash
44 changes: 44 additions & 0 deletions .github/workflows/status-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ jobs:

- name: Build artifact
uses: ./.github/actions/build
id: build
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: irma-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ steps.build.outputs.artifact-name }}

docker-build:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -89,6 +96,43 @@ jobs:
- name: Run all unit tests
run: docker-compose run test -v ./...

# The integration tests are split into two jobs, one for the client side and one for the server side.
# They test whether irmago versions with different versions of gabi can interact.
# We assume that the keyshare server is always kept up to date, so we don't test using older versions of the keyshare server.
integration-test-clientside: # Checks whether irmaclient interacts with older IRMA servers
needs: build
strategy:
matrix:
irma-server:
- v0.13.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run integration test
uses: ./.github/actions/integration-test
with:
ref: ${{ github.ref }}
irma-server-artifact: https://github.com/privacybydesign/irmago/releases/download/${{ matrix.irma-server }}/irma-linux-amd64
keyshare-server-artifact: irma-linux-amd64 # Current build

integration-test-serverside: # Checks whether IRMA server interacts with older irmaclients
needs: build
strategy:
matrix:
irmaclient-ref:
- ab3f743c339f10bd80fe79d0d8d34e8be0c430a3 # v0.13.2 (integration test did not exist when version tag was created)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run integration test
uses: ./.github/actions/integration-test
with:
test-ref: ${{ matrix.irmaclient-ref }}
irma-server-artifact: irma-linux-amd64 # Current build
keyshare-server-artifact: irma-linux-amd64 # Current build

analyze:
needs: build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion internal/sessiontest/client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The other way around, the backwards compatibility of the IRMA server and keyshar
source code of an older irmago version and run an older version of this test against a newer server version.
This integration test is being introduced after irmago v0.13.2, so older irmaclient versions cannot be tested using this setup.
This test only runs if you pass --tags=integration_tests to go test.
This test only runs if you pass --tags=integration_tests to go test, i.e.: go test --tags integration_tests -run TestClientIntegration -p 1 ./...
Before running this test, you should start the IRMA server and keyshare server manually.
First, ensure you installed the desired irma version.
Expand Down

0 comments on commit ad38759

Please sign in to comment.