Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GHA workflow for aca-py integration tests #1046

Merged
merged 7 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/integrationtests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: acapy-integration-tests
on:
workflow_dispatch:
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
test:
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
steps:
- name: checkout-acapy
uses: actions/checkout@v2
with:
path: acapy
- name: run-von-network
uses: ./acapy/actions/run-von-network
- name: run-indy-tails-server
uses: ./acapy/actions/run-indy-tails-server
- name: run-integration-tests
uses: ./acapy/actions/run-integration-tests
# to run with a specific set of tests include the following parameter:
# with:
# TEST_SCOPE: "-t @T001-RFC0037"
20 changes: 20 additions & 0 deletions actions/run-indy-tails-server/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Run Tails Server"
description: "Build and Run Indy Tails Server"
author: "[email protected]"
runs:
using: "composite"
steps:
- name: checkout-indy-tails-server
run: git clone https://github.com/bcgov/indy-tails-server.git
shell: bash
- name: build-indy-tails-server
run: ./manage build
shell: bash
working-directory: indy-tails-server/docker
- name: run-indy-tails-server
run: ./manage start
shell: bash
working-directory: indy-tails-server/docker
branding:
icon: "scissors"
color: "purple"
22 changes: 22 additions & 0 deletions actions/run-integration-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Run Aca-Py Integration Tests"
description: "Run integration tests for Aca-Py"
author: "[email protected]"
inputs:
TEST_SCOPE:
description: "Set of flags that defines the test scope"
required: false
default: "-t @GHA"
runs:
using: "composite"
steps:
- name: run-integration-tests-acapy
# to run with external ledger and tails server run as follows (and remove the ledger and tails actions from the workflow):
# run: LEDGER_URL=http://test.bcovrin.vonx.io PUBLIC_TAILS_URL=https://tails.vonx.io ./run_bdd ${{ inputs.TEST_SCOPE }}
run: ./run_bdd ${{ inputs.TEST_SCOPE }}
shell: bash
env:
NO_TTY: "1"
working-directory: acapy/demo
branding:
icon: "mic"
color: "purple"
20 changes: 20 additions & 0 deletions actions/run-von-network/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Run von-network"
description: "Build and run Indy network using von-network"
author: "[email protected]"
runs:
using: "composite"
steps:
- name: checkout-von-network
run: git clone https://github.com/bcgov/von-network.git
shell: bash
- name: build-von-network
run: ./manage build
shell: bash
working-directory: von-network
- name: run-von-network
run: ./manage start
shell: bash
working-directory: von-network
branding:
icon: "cloud-lightning"
color: "blue"
5 changes: 2 additions & 3 deletions demo/features/0036-issue-credential.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: RFC 0036 Aries agent issue credential

@T003-RFC0036 @AcceptanceTest @P1 @critical @Indy @RFC0036
@T003-RFC0036 @GHA
Scenario Outline: Issue a credential with the Issuer beginning with an offer
Given we have "2" agents
| name | role | capabilities |
Expand All @@ -17,10 +17,9 @@ Feature: RFC 0036 Aries agent issue credential
| --public-did --did-exchange | --did-exchange | driverslicense | Data_DL_NormalizedValues |
| --public-did --mediation | --mediation | driverslicense | Data_DL_NormalizedValues |
| --public-did --multitenant | --multitenant | driverslicense | Data_DL_NormalizedValues |
| --public-did --mediation --multitenant | --mediation --multitenant | driverslicense | Data_DL_NormalizedValues |


@T004-RFC0036 @AcceptanceTest @P1 @critical @Indy @RFC0036
@T004-RFC0036 @GHA
Scenario Outline: Issue a credential with revocation, with the Issuer beginning with an offer, and then revoking the credential
Given we have "2" agents
| name | role | capabilities |
Expand Down
55 changes: 44 additions & 11 deletions demo/features/0037-present-proof.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
Feature: RFC 0037 Aries agent present proof

@T001-AIP10-RFC0037 @P1 @critical @AcceptanceTest @Indy @RFC0037
@T001-RFC0037 @GHA
Scenario Outline: Present Proof where the prover does not propose a presentation of the proof and is acknowledged
Given "3" agents
Given we have "2" agents
| name | role | capabilities |
| Faber | verifier | <Acme_capabilities> |
| Bob | prover | <Bob_capabilities> |
And "<issuer>" and "Bob" have an existing connection
And "Bob" has an issued <Schema_name> credential <Credential_data> from "<issuer>"
And "Faber" and "Bob" have an existing connection
When "Faber" sends a request for proof presentation <Proof_request> to "Bob"
Then "Faber" has the proof verified

Examples:
| issuer | Acme_capabilities | Bob_capabilities | Schema_name | Credential_data | Proof_request |
| Faber | --public-did | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Faber | --public-did --did-exchange | --did-exchange | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |


@T001.1-RFC0037
Scenario Outline: Present Proof where the prover does not propose a presentation of the proof and is acknowledged
Given we have "3" agents
| name | role | capabilities |
| Acme | issuer | <Acme_capabilities> |
| Faber | verifier | <Acme_capabilities> |
Expand All @@ -17,15 +35,31 @@ Feature: RFC 0037 Aries agent present proof
| issuer | Acme_capabilities | Bob_capabilities | Schema_name | Credential_data | Proof_request |
| Acme | --public-did | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Faber | --public-did | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --public-did --did-exchange | --did-exchange | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --public-did --mediation | --mediation | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --public-did --multitenant | --multitenant | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --public-did --mediation --multitenant | --mediation --multitenant | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |


@T002-AIP10-RFC0037 @P1 @critical @AcceptanceTest @Indy @RFC0037
@T002-RFC0037 @GHA
Scenario Outline: Present Proof where the issuer revokes the credential and the proof fails
Given we have "2" agents
| name | role | capabilities |
| Faber | verifier | <Acme_capabilities> |
| Bob | prover | <Bob_capabilities> |
And "<issuer>" and "Bob" have an existing connection
And "Bob" has an issued <Schema_name> credential <Credential_data> from "<issuer>"
And "<issuer>" revokes the credential
And "Faber" and "Bob" have an existing connection
When "Faber" sends a request for proof presentation <Proof_request> to "Bob"
Then "Faber" has the proof verification fail

Examples:
| issuer | Acme_capabilities | Bob_capabilities | Schema_name | Credential_data | Proof_request |
| Faber | --revocation --public-did | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Faber | --revocation --public-did --did-exchange | --did-exchange | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |


@T002.1-RFC0037
Scenario Outline: Present Proof where the issuer revokes the credential and the proof fails
Given "3" agents
Given we have "3" agents
| name | role | capabilities |
| Acme | issuer | <Acme_capabilities> |
| Faber | verifier | <Acme_capabilities> |
Expand All @@ -40,7 +74,6 @@ Feature: RFC 0037 Aries agent present proof
Examples:
| issuer | Acme_capabilities | Bob_capabilities | Schema_name | Credential_data | Proof_request |
| Acme | --revocation --public-did | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Faber | --revocation --public-did | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --revocation --public-did --did-exchange | --did-exchange | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --revocation --public-did --mediation | --mediation | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --revocation --public-did --multitenant | --multitenant | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Faber | --revocation --public-did | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --revocation --public-did --mediation | | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
| Acme | --revocation --public-did --multitenant | --multitenant | driverslicense | Data_DL_NormalizedValues | DL_age_over_19 |
2 changes: 1 addition & 1 deletion demo/features/0160-connection.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: RFC 0160 Aries agent connection functions

@T001-AIP10-RFC0160 @P1 @critical @AcceptanceTest @RFC0160
@T001-RFC0160 @GHA
Scenario Outline: establish a connection between two agents
Given we have "2" agents
| name | role | capabilities |
Expand Down
24 changes: 23 additions & 1 deletion demo/features/0586-sign-transaction.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: RFC 0586 Aries sign (endorse) transactions functions

@T001-RFC0586 @P1 @critical @AcceptanceTest @RFC0586
@T001-RFC0586 @GHA
Scenario Outline: endorse a transaction and write to the ledger
Given we have "2" agents
| name | role | capabilities |
Expand All @@ -23,3 +23,25 @@ Feature: RFC 0586 Aries sign (endorse) transactions functions
| --did-exchange | --did-exchange | driverslicense |
| --mediation | --mediation | driverslicense |
| --multitenant | --multitenant | driverslicense |


@T001.1-RFC0586
Scenario Outline: endorse a transaction and write to the ledger
Given we have "2" agents
| name | role | capabilities |
| Acme | endorser | <Acme_capabilities> |
| Bob | author | <Bob_capabilities> |
And "Acme" and "Bob" have an existing connection
When "Acme" has a DID with role "ENDORSER"
And "Bob" has a DID with role "AUTHOR"
And "Acme" connection has job role "TRANSACTION_ENDORSER"
And "Bob" connection has job role "TRANSACTION_AUTHOR"
And "Bob" authors a schema transaction with <Schema_name>
And "Bob" requests endorsement for the transaction
And "Acme" endorses the transaction
Then "Bob" can write the transaction to the ledger
And "Bob" has written the schema <Schema_name> to the ledger

Examples:
| Acme_capabilities | Bob_capabilities | Schema_name |
| --mediation --multitenant | --mediation --multitenant | driverslicense |
4 changes: 2 additions & 2 deletions demo/run_bdd
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ done

AGENT_MODULE="agent_container"
AGENT_PORT=8020
AGENT_PORT_RANGE=8020-8099
AGENT_PORT_RANGE=8020-8079

echo "Preparing agent image..."
docker build -q -t faber-alice-demo -f ../docker/Dockerfile.demo .. || exit 1
Expand Down Expand Up @@ -225,7 +225,7 @@ if [ "$OSTYPE" = "msys" ]; then
fi
DOCKER=${DOCKER:-docker}

$DOCKER run --name $AGENT --rm -it ${DOCKER_OPTS} \
$DOCKER run --name $AGENT --rm ${DOCKER_OPTS} \
--network=${DOCKER_NET} \
-p 0.0.0.0:$AGENT_PORT_RANGE:$AGENT_PORT_RANGE \
-v "/$(pwd)/../logs:/home/indy/logs" \
Expand Down
13 changes: 6 additions & 7 deletions demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ async def register_schema_and_creddef(
log_json(json.dumps(schema_response), label="Schema:")
schema_id = schema_response["schema_id"]
log_msg("Schema ID:", schema_id)
await asyncio.sleep(2.0)

# Create a cred def for the schema
cred_def_tag = (
Expand Down Expand Up @@ -493,6 +494,7 @@ def _process(self, args, env, loop):
stderr=subprocess.PIPE,
env=env,
encoding="utf-8",
close_fds=True,
)
loop.run_in_executor(
None,
Expand Down Expand Up @@ -526,9 +528,8 @@ async def start_process(self, python_path: str = None, wait: bool = True):

# start agent sub-process
loop = asyncio.get_event_loop()
self.proc = await loop.run_in_executor(
None, self._process, agent_args, my_env, loop
)
future = loop.run_in_executor(None, self._process, agent_args, my_env, loop)
self.proc = await asyncio.wait_for(future, 20, loop=loop)
if wait:
await asyncio.sleep(1.0)
await self.detect_process()
Expand All @@ -546,18 +547,16 @@ def _terminate(self):

async def terminate(self):
# close session to admin api
self.log("Shutting down admin api session")
await self.client_session.close()
# shut down web hooks first
self.log("Shutting down web hooks site")
if self.webhook_site:
await self.webhook_site.stop()
await asyncio.sleep(0.5)
# now shut down the agent
self.log("Shutting down agent")
loop = asyncio.get_event_loop()
if self.proc:
await loop.run_in_executor(None, self._terminate)
future = loop.run_in_executor(None, self._terminate)
result = await asyncio.wait_for(future, 10, loop=loop)

async def listen_webhooks(self, webhook_port):
self.webhook_port = webhook_port
Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile.bdd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM faber-alice-demo
# Install bdd dependencies
RUN pip3 install --no-cache-dir -r demo/requirements.behave.txt

# ENTRYPOINT ["bash", "-c", "demo/ngrok-wait.sh \"$@\"", "--"]
WORKDIR ./demo
RUN chmod a+w .
ENTRYPOINT ["behave"]