Skip to content

Commit

Permalink
test: add didcomm test
Browse files Browse the repository at this point in the history
Signed-off-by: Allain Magyar <allain.magyar@iohk.io>
  • Loading branch information
amagyar-iohk committed Oct 31, 2024
1 parent 5830a7e commit d193c55
Show file tree
Hide file tree
Showing 33 changed files with 221,539 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:
defaults:
run:
shell: bash
working-directory: "tests/integration-tests"

permissions:
checks: write
Expand Down Expand Up @@ -58,12 +57,10 @@ jobs:
- name: Build local version of Cloud Agent
id: build_local_cloud_agent
env:
CLOUD_AGENT_PATH: "../.."
ENV_FILE: "infrastructure/local/.env"
GITHUB_ACTOR: hyperledger-bot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd "${CLOUD_AGENT_PATH}" || exit 129
sbt docker:publishLocal
echo "agent_version=$(cut -d'=' -f2 version.sbt | tr -d '" ')" >> "${GITHUB_OUTPUT}"
echo "prism_node_version=$(grep PRISM_NODE_VERSION infrastructure/local/.env | cut -d'=' -f2 | tr -d ' ')" >> "${GITHUB_OUTPUT}"
Expand All @@ -74,6 +71,7 @@ jobs:
java-version: "19"

- name: Run integration tests
working-directory: "tests/integration-tests"
env:
PRISM_NODE_VERSION: ${{ steps.build_local_cloud_agent.outputs.prism_node_version }}
AGENT_VERSION: ${{ steps.build_local_cloud_agent.outputs.agent_version }}
Expand All @@ -83,6 +81,15 @@ jobs:
run: |
./gradlew test --tests "IntegrationTestsRunner"
- name: Run didcomm tests
working-directory: "tests/didcomm-tests"
env:
AGENT_VERSION: ${{ steps.build_local_cloud_agent.outputs.agent_version }}
run: |
./docker/run.sh "$AGENT_VERSION"
node dist/suite.spec.js
./docker/stop.sh
- name: Make report of integration tests
if: always()
env:
Expand Down
2 changes: 2 additions & 0 deletions tests/didcomm-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
junit.xml
54 changes: 54 additions & 0 deletions tests/didcomm-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# DidComm tests

This integration tests leverage a modified version of the identus typescript
edge-agent that enable us to modify the didcomm requests.

This modified library is in the `tgz` file located in the root.

## Build

To speed up the execution time in github runner, there's a `build` script that
creates a bundled execution file in the `dist` folder which can be executed
using only the `node dist/suite.spec.js` command.

To build the dist file just execute `npm run build`.

The execution in github runner uses the `dist` version

## Usage

Before starting the tests you have to have the `cloud-agent` and `mediator` running

You can start by `cd docker` and running `./run.sh <cloud-agent-version>` script.

> It uses the ports 8080, 8090, 8091

### Environment variables

| variable | description | default |
| ---------------- | ----------------------------------- | ----------------------------------- |
| CLOUD_AGENT_URL | Url for cloud-agent | http://localhost:8090 |
| MEDIATOR_OOB_URL | Url for mediator oob invitation | http://localhost:8080/invitationOOB |
| WEBHOOK_PORT | Port for the local server listen to | 3000 |
| WEBHOOK_URL | Url for webhook url | http://host.docker.internal:3000 |

### Running tests

Install the dependencies running `npm i`.

To run the entire suite during the development you can use `npm test`.

or

You can filter the test by name using `npx tsx --test --test-reporter spec "./test/<file-name>.ts"`
to run a single file.

## Implementing new scenarios

Add the test to the `test` folder with `.spec.ts` extension.

This test uses the [node test framework](https://nodejs.org/api/test.html) for
simplicity and [chai library](https://www.chaijs.com/) for assertions.

> Remember to run `npm run build` to generate the bundled file for the automation
Loading

0 comments on commit d193c55

Please sign in to comment.