From b882f15223966a65b02d14ea6ca66c8a33d8b80a Mon Sep 17 00:00:00 2001 From: PatStLouis Date: Thu, 13 Feb 2025 19:54:09 +0000 Subject: [PATCH 1/4] add run in docker instructions Signed-off-by: PatStLouis --- .gitignore | 1 + docker/README.md | 33 +++++++++++++++++++++++++++++++++ docker/docker-compose.yml | 32 ++++++++++++++++++++++++++++++++ docker/localConfig.example.yml | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml create mode 100644 docker/localConfig.example.yml diff --git a/.gitignore b/.gitignore index c2658d7..0d258fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +localConfig.yml \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..1cba5c4 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,33 @@ + + +# Testing in docker + +To run your implementation against all test suites from one location, you can use this docker-compose project. + +## Pre requisites +- [Docker](https://docs.docker.com/compose/install/) + +## Setup + +Make sure you are in the `docker` directory, then copy the `localConfig` example file: +```bash +cd ./docker +cp localConfig.example.yml localConfig.yml +``` +Edit the local config details to match your implementation. + +Once you are done, you can run the test-suites with: +```bash +docker compose up --build +``` + +When the tests are completed, you will be able to access the reports in your browser: +- [vc-data-model-v2](http://vc-data-model.docker.localhost/) +- [vc-bitstring-status-list](http://vc-bitstring-status-list.docker.localhost/) +- [vc-di-eddsa](http://vc-di-eddsa.docker.localhost/) +- [vc-di-ecdsa](http://vc-di-ecdsa.docker.localhost/) +- [vc-di-bbs](http://vc-di-bbs.docker.localhost/) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..2a49f01 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,32 @@ +--- +include: + - localConfig.yml +services: + vc-data-model-v2: + build: https://github.com/w3c/vc-data-model-2.0-test-suite.git#allure-in-docker + command: + - /bin/bash + - -c + - | + npm t + serve -p 8000 reports/ + configs: + - source: localConfig.cjs + target: /test-suite/localConfig.cjs + labels: + - traefik.enable=true + - traefik.http.routers.vc-data-model.rule=Host(`vc-data-model.docker.localhost`) + - traefik.http.routers.vc-data-model.entrypoints=web + - traefik.http.services.vc-data-model.loadbalancer.server.port=8000 + + traefik: + image: traefik:v3.1 + command: + - --api.insecure=true + - --providers.docker=true + - --providers.docker.exposedbydefault=false + - --entryPoints.web.address=:80 + ports: + - 80:80 + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro \ No newline at end of file diff --git a/docker/localConfig.example.yml b/docker/localConfig.example.yml new file mode 100644 index 0000000..8228829 --- /dev/null +++ b/docker/localConfig.example.yml @@ -0,0 +1,34 @@ + +configs: + localConfig.cjs: + content: | + const baseUrl = process.env.BASE_URL || 'http://implementation:8000'; + module.exports = { + settings: {}, + implementations: [ + { + name: 'My Company', + implementation: 'My Implementation Name', + issuers: [ + { + id: '', + endpoint: `${baseUrl}/credentials/issue`, + options: {}, + tags: ['vc2.0'] + } + ], + verifiers: [{ + id: '', + endpoint: `${baseUrl}/credentials/verify`, + options: {}, + tags: ['vc2.0'] + }], + vpVerifiers: [{ + id: '', + endpoint: `${baseUrl}/presentations/verify`, + options: {}, + tags: ['vc2.0'] + }] + } + ] + }; \ No newline at end of file From e4882fdfaef9ac060b68e6999b13000b8648c672 Mon Sep 17 00:00:00 2001 From: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:52:44 -0500 Subject: [PATCH 2/4] Update .gitignore Co-authored-by: BigBlueHat --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0d258fa..103ca5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ node_modules/ -localConfig.yml \ No newline at end of file +docker/localConfig.yml \ No newline at end of file From 5e0494e596bdbe8e8540a58ef6ae6ca5d7bf83b8 Mon Sep 17 00:00:00 2001 From: Patrick St-Louis <43082425+PatStLouis@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:54:44 -0500 Subject: [PATCH 3/4] Update docker/README.md Co-authored-by: BigBlueHat --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 1cba5c4..db737fe 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,5 +1,5 @@ From e021badf035d593d05298a6cb4d7ffdfd98bc7ab Mon Sep 17 00:00:00 2001 From: PatStLouis Date: Thu, 13 Feb 2025 22:23:22 +0000 Subject: [PATCH 4/4] update implementation file to json Signed-off-by: PatStLouis --- .gitignore | 2 +- docker/README.md | 4 ++-- docker/docker-compose.yml | 19 ++++++++++++++-- docker/implementation.example.yml | 38 +++++++++++++++++++++++++++++++ docker/localConfig.example.yml | 34 --------------------------- 5 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 docker/implementation.example.yml delete mode 100644 docker/localConfig.example.yml diff --git a/.gitignore b/.gitignore index 0d258fa..0525c21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ node_modules/ -localConfig.yml \ No newline at end of file +docker/implemenation.yml \ No newline at end of file diff --git a/docker/README.md b/docker/README.md index 1cba5c4..7ea63d1 100644 --- a/docker/README.md +++ b/docker/README.md @@ -13,10 +13,10 @@ To run your implementation against all test suites from one location, you can us ## Setup -Make sure you are in the `docker` directory, then copy the `localConfig` example file: +Make sure you are in the `docker` directory, then copy the `implementation` example file: ```bash cd ./docker -cp localConfig.example.yml localConfig.yml +cp implementation.example.yml implementation.yml ``` Edit the local config details to match your implementation. diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 2a49f01..453e972 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,6 +1,6 @@ --- include: - - localConfig.yml + - implementation.yml services: vc-data-model-v2: build: https://github.com/w3c/vc-data-model-2.0-test-suite.git#allure-in-docker @@ -13,6 +13,8 @@ services: configs: - source: localConfig.cjs target: /test-suite/localConfig.cjs + - source: implementation.json + target: /test-suite/implementation.json labels: - traefik.enable=true - traefik.http.routers.vc-data-model.rule=Host(`vc-data-model.docker.localhost`) @@ -29,4 +31,17 @@ services: ports: - 80:80 volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro \ No newline at end of file + - /var/run/docker.sock:/var/run/docker.sock:ro + + +configs: + localConfig.cjs: + content: | + module.exports = { + settings: { + enableInteropTests: true + }, + implementations: [ + require('/test-suite/implementation.json') + ] + }; \ No newline at end of file diff --git a/docker/implementation.example.yml b/docker/implementation.example.yml new file mode 100644 index 0000000..fbbd100 --- /dev/null +++ b/docker/implementation.example.yml @@ -0,0 +1,38 @@ +--- +configs: + implementation.json: + content: | + { + "name": "My Company", + "implementation": "My Implementation Name", + "issuers": [ + { + "id": "", + "endpoint": "", + "options": {}, + "tags": [ + "vc2.0" + ] + } + ], + "verifiers": [ + { + "id": "", + "endpoint": "", + "options": {}, + "tags": [ + "vc2.0" + ] + } + ], + "vpVerifiers": [ + { + "id": "", + "endpoint": "", + "options": {}, + "tags": [ + "vc2.0" + ] + } + ] + } \ No newline at end of file diff --git a/docker/localConfig.example.yml b/docker/localConfig.example.yml deleted file mode 100644 index 8228829..0000000 --- a/docker/localConfig.example.yml +++ /dev/null @@ -1,34 +0,0 @@ - -configs: - localConfig.cjs: - content: | - const baseUrl = process.env.BASE_URL || 'http://implementation:8000'; - module.exports = { - settings: {}, - implementations: [ - { - name: 'My Company', - implementation: 'My Implementation Name', - issuers: [ - { - id: '', - endpoint: `${baseUrl}/credentials/issue`, - options: {}, - tags: ['vc2.0'] - } - ], - verifiers: [{ - id: '', - endpoint: `${baseUrl}/credentials/verify`, - options: {}, - tags: ['vc2.0'] - }], - vpVerifiers: [{ - id: '', - endpoint: `${baseUrl}/presentations/verify`, - options: {}, - tags: ['vc2.0'] - }] - } - ] - }; \ No newline at end of file