-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into new-keyshare-protocol
- Loading branch information
Showing
6 changed files
with
243 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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@v3 | ||
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@v3 | ||
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 | ||
env: | ||
IRMAGO_INTEGRATION_TESTS: Y | ||
run: go test -v -run TestClientIntegration -p 1 ./... | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package sessiontest | ||
|
||
/* | ||
This file contains the integration tests for the irmaclient library. | ||
A subset of tests from session_test.go and keyshare_test.go can be run against specific versions of the IRMA server and keyshare server. | ||
In this way we test the backwards compatibility of the irmaclient library. | ||
The other way around, the backwards compatibility of the IRMA server and keyshare server, can be tested by checking out the | ||
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 IRMAGO_INTEGRATION_TESTS=Y to go test, i.e.: IRMAGO_INTEGRATION_TESTS=Y go test -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. | ||
To start the IRMA server, run the following command: | ||
$ irma server -s testdata/irma_configuration --url http://localhost:port -p 48682 -k testdata/privatekeys | ||
To start the keyshare server, run the following commands: | ||
$ docker-compose up -d | ||
$ irma keyshare server -c testdata/configurations/keyshareserver.yml | ||
*/ | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
"testing" | ||
|
||
irma "github.com/privacybydesign/irmago" | ||
"github.com/privacybydesign/irmago/internal/test" | ||
) | ||
|
||
func TestClientIntegration(t *testing.T) { | ||
if !strings.HasPrefix(strings.ToUpper(os.Getenv("IRMAGO_INTEGRATION_TESTS")), "Y") { | ||
t.Skip("set IRMAGO_INTEGRATION_TESTS=Y to run this test") | ||
} | ||
|
||
// Tests without keyshare server. | ||
t.Run("DisclosureSession", apply(testDisclosureSession, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("NoAttributeDisclosureSession", apply(testNoAttributeDisclosureSession, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("EmptyDisclosure", apply(testEmptyDisclosure, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("SigningSession", apply(testSigningSession, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuanceSession", apply(testIssuanceSession, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("MultipleIssuanceSession", apply(testMultipleIssuanceSession, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("DefaultCredentialValidity", apply(testDefaultCredentialValidity, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuanceDisclosureEmptyAttributes", apply(testIssuanceDisclosureEmptyAttributes, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuanceOptionalZeroLengthAttributes", apply(testIssuanceOptionalZeroLengthAttributes, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuanceOptionalSetAttributes", apply(testIssuanceOptionalSetAttributes, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuanceSameAttributesNotSingleton", apply(testIssuanceSameAttributesNotSingleton, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuancePairing", apply(testIssuancePairing, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("PairingRejected", apply(testPairingRejected, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("LargeAttribute", apply(testLargeAttribute, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuanceSingletonCredential", apply(testIssuanceSingletonCredential, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("UnsatisfiableDisclosureSession", apply(testUnsatisfiableDisclosureSession, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("AttributeByteEncoding", apply(testAttributeByteEncoding, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("IssuedCredentialIsStored", apply(testIssuedCredentialIsStored, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("BlindIssuanceSession", apply(testBlindIssuanceSession, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("DisablePairing", apply(testDisablePairing, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("DisclosureMultipleAttrs", apply(testDisclosureMultipleAttrs, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("CombinedSessionMultipleAttributes", apply(testCombinedSessionMultipleAttributes, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("ConDisCon", apply(testConDisCon, nil, optionReuseServer, optionForceNoAuth)) | ||
t.Run("OptionalDisclosure", apply(testOptionalDisclosure, nil, optionReuseServer, optionForceNoAuth)) | ||
|
||
// Test with keyshare server. | ||
t.Run("KeyshareSessions", func(t *testing.T) { | ||
storage := test.CreateTestStorage(t) | ||
client, handler := parseExistingStorage(t, storage) | ||
defer test.ClearTestStorage(t, client, handler.storage) | ||
|
||
// Fresh irmaclient storage was used, so we need to do some initialization. | ||
client.KeyshareEnroll(irma.NewSchemeManagerIdentifier("test"), nil, "12345", "en") | ||
req := getIssuanceRequest(false) | ||
doSession(t, req, client, nil, nil, nil, nil, optionReuseServer, optionForceNoAuth) | ||
|
||
keyshareSessions(t, client, nil, optionReuseServer, optionForceNoAuth) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters