diff --git a/.github/actions/run-unit-tests/action.yml b/.github/actions/run-unit-tests/action.yml index 9675c99bc0..1bff008933 100644 --- a/.github/actions/run-unit-tests/action.yml +++ b/.github/actions/run-unit-tests/action.yml @@ -30,7 +30,7 @@ runs: - name: Tests shell: bash run: | - poetry run pytest --cov=aries_cloudagent --cov-report term-missing --cov-report xml --ignore-glob=/tests/* --ignore-glob=demo/* --ignore-glob=docker/* --ignore-glob=docs/* --ignore-glob=scripts/* 2>&1 | tee pytest.log + poetry run pytest --cov=aries_cloudagent --cov-report term-missing --cov-report xml --ignore-glob=/tests/* --ignore-glob=demo/* --ignore-glob=docker/* --ignore-glob=docs/* --ignore-glob=scripts/* --ignore-glob=scenarios/* 2>&1 | tee pytest.log PYTEST_EXIT_CODE=${PIPESTATUS[0]} if grep -Eq "RuntimeWarning: coroutine .* was never awaited" pytest.log; then echo "Failure: Detected unawaited coroutine warning in pytest output." diff --git a/.github/workflows/bdd-integration-tests.yml b/.github/workflows/bdd-integration-tests.yml index aa1cd47e75..a6a646a863 100644 --- a/.github/workflows/bdd-integration-tests.yml +++ b/.github/workflows/bdd-integration-tests.yml @@ -20,7 +20,7 @@ defaults: jobs: test: runs-on: ubuntu-latest - if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request') + if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'jamshale/aries-cloudagent-python') || (github.event_name != 'pull_request') outputs: is_release: ${{ steps.check_if_release.outputs.is_release }} steps: @@ -36,6 +36,7 @@ jobs: src: - aries_cloudagent/**/* - poetry.lock + - pyproject.toml demo: "demo/**/*" - name: Check if demo or src files changed id: check-if-demo-or-src-changed diff --git a/.github/workflows/bdd-interop-tests.yml b/.github/workflows/bdd-interop-tests.yml index 42559367cd..dc1c837da0 100644 --- a/.github/workflows/bdd-interop-tests.yml +++ b/.github/workflows/bdd-interop-tests.yml @@ -20,7 +20,7 @@ defaults: jobs: test: runs-on: ubuntu-latest - if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request') + if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'jamshale/aries-cloudagent-python') || (github.event_name != 'pull_request') outputs: is_release: ${{ steps.check_if_release.outputs.is_release }} steps: @@ -36,6 +36,7 @@ jobs: src: - aries_cloudagent/**/* - poetry.lock + - pyproject.toml - name: Check if src files changed id: check-if-src-changed run: | @@ -65,7 +66,7 @@ jobs: if [ ${{ github.event_name }} == 'pull_request' ]; then echo ${{ fromJson(steps.get_pr_data.outputs.data).head.repo.html_url }} echo ${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} - sed -i 's|@git+https://github.com/hyperledger/aries-cloudagent-python@main|@git+${{ fromJson(steps.get_pr_data.outputs.data).head.repo.html_url }}@${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}|g' ./aries-agent-test-harness/aries-backchannels/acapy/requirements-main.txt + sed -i 's|@git+https://github.com/jamshale/aries-cloudagent-python@main|@git+${{ fromJson(steps.get_pr_data.outputs.data).head.repo.html_url }}@${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}|g' ./aries-agent-test-harness/aries-backchannels/acapy/requirements-main.txt fi cat aries-agent-test-harness/aries-backchannels/acapy/requirements-main.txt diff --git a/.github/workflows/scenario-integration-tests.yml b/.github/workflows/scenario-integration-tests.yml index 4faa010315..d506a4f392 100644 --- a/.github/workflows/scenario-integration-tests.yml +++ b/.github/workflows/scenario-integration-tests.yml @@ -20,7 +20,7 @@ defaults: jobs: test: runs-on: ubuntu-latest - if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request') + if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.repository == 'jamshale/aries-cloudagent-python') || (github.event_name != 'pull_request') steps: - name: checkout-acapy uses: actions/checkout@v4 @@ -35,6 +35,7 @@ jobs: src: - aries_cloudagent/**/* - poetry.lock + - pyproject.toml - name: Check if scenarios or src files changed id: check-if-scenarios-or-src-changed run: | diff --git a/.github/workflows/sonar-merge-main.yml b/.github/workflows/sonar-merge-main.yml index e63f649f7e..759a38d75b 100644 --- a/.github/workflows/sonar-merge-main.yml +++ b/.github/workflows/sonar-merge-main.yml @@ -30,5 +30,6 @@ jobs: with: args: > -Dsonar.python.coverage.reportPaths=test-reports/coverage.xml - -Dsonar.coverage.exclusions=**/tests/*,**/demo/*,**/docs/*,**/docker/*,**/scripts/* + -Dsonar.coverage.exclusions=**/tests/*,**/demo/*,**/docs/*,**/docker/*,**/scripts/*,**/scenarios/* + -Dsonar.cpd.exclusions=**/tests/*,**/demo/*,**/docs/*,**/docker/*,**/scripts/*,**/scenarios/* -Dsonar.sources=./ \ No newline at end of file diff --git a/.github/workflows/sonar-pr.yml b/.github/workflows/sonar-pr.yml index 660cf8730e..52ea894b9e 100644 --- a/.github/workflows/sonar-pr.yml +++ b/.github/workflows/sonar-pr.yml @@ -68,6 +68,7 @@ jobs: -Dsonar.pullrequest.key=${{ fromJson(steps.get_pr_data.outputs.data).number }} -Dsonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} -Dsonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} - -Dsonar.coverage.exclusions=**/tests/*,**/demo/*,**/docs/*,**/docker/*,**/scripts/* + -Dsonar.coverage.exclusions=**/tests/*,**/demo/*,**/docs/*,**/docker/*,**/scripts/*,**/scenarios/* + -Dsonar.cpd.exclusions=**/tests/*,**/demo/*,**/docs/*,**/docker/*,**/scripts/*,**/scenarios/* -Dsonar.python.coverage.reportPaths=test-reports/coverage.xml -Dsonar.sources=./ \ No newline at end of file diff --git a/scenarios/examples/simple-copy-test/docker-compose.yml b/scenarios/examples/simple-copy-test/docker-compose.yml new file mode 100644 index 0000000000..7bc9e0852a --- /dev/null +++ b/scenarios/examples/simple-copy-test/docker-compose.yml @@ -0,0 +1,91 @@ + services: + alice: + image: acapy-test + ports: + - "3001:3001" + environment: + RUST_LOG: 'aries-askar::log::target=error' + command: > + start + --label Alice + --inbound-transport http 0.0.0.0 3000 + --outbound-transport http + --endpoint http://alice:3000 + --admin 0.0.0.0 3001 + --admin-insecure-mode + --tails-server-base-url http://tails:6543 + --genesis-url http://test.bcovrin.vonx.io/genesis + --wallet-type askar + --wallet-name alice + --wallet-key insecure + --auto-provision + --log-level debug + --debug-webhooks + healthcheck: + test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null + start_period: 30s + interval: 7s + timeout: 5s + retries: 5 + depends_on: + tails: + condition: service_started + + bob: + image: acapy-test + ports: + - "3002:3001" + environment: + RUST_LOG: 'aries-askar::log::target=error' + command: > + start + --label Bob + --inbound-transport http 0.0.0.0 3000 + --outbound-transport http + --endpoint http://bob:3000 + --admin 0.0.0.0 3001 + --admin-insecure-mode + --tails-server-base-url http://tails:6543 + --genesis-url http://test.bcovrin.vonx.io/genesis + --wallet-type askar + --wallet-name bob + --wallet-key insecure + --auto-provision + --log-level debug + --debug-webhooks + --monitor-revocation-notification + healthcheck: + test: curl -s -o /dev/null -w '%{http_code}' "http://localhost:3001/status/live" | grep "200" > /dev/null + start_period: 30s + interval: 7s + timeout: 5s + retries: 5 + + tails: + image: ghcr.io/bcgov/tails-server:latest + ports: + - 6543:6543 + environment: + - GENESIS_URL=http://test.bcovrin.vonx.io/genesis + command: > + tails-server + --host 0.0.0.0 + --port 6543 + --storage-path /tmp/tails-files + --log-level INFO + + example: + container_name: controller + build: + context: ../.. + environment: + - ALICE=http://alice:3001 + - BOB=http://bob:3001 + volumes: + - ./example.py:/usr/src/app/example.py:ro,z + command: python -m example + depends_on: + alice: + condition: service_healthy + bob: + condition: service_healthy diff --git a/scenarios/examples/simple-copy-test/example.py b/scenarios/examples/simple-copy-test/example.py new file mode 100644 index 0000000000..20830dfcc9 --- /dev/null +++ b/scenarios/examples/simple-copy-test/example.py @@ -0,0 +1,26 @@ +"""Minimal reproducible example script. + +This script is for you to use to reproduce a bug or demonstrate a feature. +""" + +import asyncio +from os import getenv + +from acapy_controller import Controller +from acapy_controller.logging import logging_to_stdout +from acapy_controller.protocols import connection, didexchange + +ALICE = getenv("ALICE", "http://alice:3001") +BOB = getenv("BOB", "http://bob:3001") + + +async def main(): + """Test Controller protocols.""" + async with Controller(base_url=ALICE) as alice, Controller(base_url=BOB) as bob: + await connection(alice, bob) + await didexchange(alice, bob) + + +if __name__ == "__main__": + logging_to_stdout() + asyncio.run(main()) diff --git a/sonar-project.properties b/sonar-project.properties index 6c87546ee1..0bd04517e1 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,5 +1,5 @@ -sonar.projectKey=hyperledger_aries-cloudagent-python -sonar.organization=hyperledger +sonar.projectKey=jamshale_aries-cloudagent-python +sonar.organization=jamshale sonar.projectName=aries-cloudagent-python sonar.python.version=3.12 \ No newline at end of file