From b77f699f025cf7be827430558681eceae72f1a04 Mon Sep 17 00:00:00 2001 From: NilashishC Date: Wed, 23 Apr 2025 11:06:56 +0530 Subject: [PATCH 1/3] Add collection-test-integration-check Signed-off-by: NilashishC --- .github/workflows/collection.yml | 38 ++++++++++++++++++++++++++++++++ Makefile | 4 ++++ 2 files changed, 42 insertions(+) diff --git a/.github/workflows/collection.yml b/.github/workflows/collection.yml index d33cd1be..93c822e8 100644 --- a/.github/workflows/collection.yml +++ b/.github/workflows/collection.yml @@ -97,6 +97,44 @@ jobs: # "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/" # done + coverage_test: + name: collection integration check + runs-on: ubuntu-latest + env: + HEADLESS: "yes" + steps: + - uses: actions/checkout@v3 + with: + repository: NilashishC/aap-gateway + token: ${{ secrets.AAP_GATEWAY_REPO_TOKEN }} + + - name: Checkout DAB branch if needed + env: + PR_BODY: ${{ github.event.pull_request.body }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: tools/scripts/get_dab_for_pr.py + + - name: Start the dev environment + run: COMPOSE_UP_OPTS='-d' make docker-compose + + - name: Install make + run: sudo apt install make + + - name: Install python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install requirements + run: pip3.11 install -r requirements/requirements_dev.txt ansible-core + + - uses: actions/checkout@v3 + with: + path: ansible-platform + + - name: Perform completeness tests + run: cd ansible-platform && make collection-test-integration-check + docs: name: Check module doc strings runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 8d36e609..026b5508 100644 --- a/Makefile +++ b/Makefile @@ -75,3 +75,7 @@ collection-test: collection-install cat /tmp/collections/ansible_collections/ansible/platform/tests/integration/integration_config.yml && \ cd /tmp/collections/ansible_collections/ansible/platform && \ ansible-test integration --venv --requirements --coverage + +## Run the collections test-integration check to see if all modules have integration tests +collection-test-integration-check: + ./tests/test_integration_check.py From 8f9200acb58ec0a9a9846dc44dc7a793f6f6988e Mon Sep 17 00:00:00 2001 From: NilashishC Date: Wed, 23 Apr 2025 11:21:09 +0530 Subject: [PATCH 2/3] Add collection-test-completeness Signed-off-by: NilashishC --- .github/workflows/collection.yml | 79 +++++++++++++++++++++++--------- Makefile | 5 ++ 2 files changed, 63 insertions(+), 21 deletions(-) diff --git a/.github/workflows/collection.yml b/.github/workflows/collection.yml index 93c822e8..da7561bc 100644 --- a/.github/workflows/collection.yml +++ b/.github/workflows/collection.yml @@ -76,26 +76,25 @@ jobs: testing-type: sanity target-python-version: 3.11 - # TO-DO - # - name: Upload gateway jUnit test reports to the unified dashboard - # if: >- - # !cancelled() - # && steps.make-run.outputs.test-result-files != '' - # && github.event_name == 'push' - # && env.UPSTREAM_REPOSITORY_ID == github.repository_id - # && github.ref_name == github.event.repository.default_branch - # run: | - # for junit_file in $(echo '${{ steps.make-run.outputs.test-result-files }}' | sed 's/,/ /') - # do - # curl \ - # -v \ - # --user "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" \ - # --form "xunit_xml=@${junit_file}" \ - # --form "component_name=gateway" \ - # --form "git_commit_sha=${{ github.sha }}" \ - # --form "git_repository_url=https://github.com/${{ github.repository }}" \ - # "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/" - # done + - name: Upload gateway jUnit test reports to the unified dashboard + if: >- + !cancelled() + && steps.make-run.outputs.test-result-files != '' + && github.event_name == 'push' + && env.UPSTREAM_REPOSITORY_ID == github.repository_id + && github.ref_name == github.event.repository.default_branch + run: | + for junit_file in $(echo '${{ steps.make-run.outputs.test-result-files }}' | sed 's/,/ /') + do + curl \ + -v \ + --user "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" \ + --form "xunit_xml=@${junit_file}" \ + --form "component_name=gateway" \ + --form "git_commit_sha=${{ github.sha }}" \ + --form "git_repository_url=https://github.com/${{ github.repository }}" \ + "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/" + done coverage_test: name: collection integration check @@ -127,7 +126,7 @@ jobs: - name: Install requirements run: pip3.11 install -r requirements/requirements_dev.txt ansible-core - + - uses: actions/checkout@v3 with: path: ansible-platform @@ -135,6 +134,44 @@ jobs: - name: Perform completeness tests run: cd ansible-platform && make collection-test-integration-check + completeness_test: + name: collection completeness test + runs-on: ubuntu-latest + env: + HEADLESS: "yes" + steps: + - uses: actions/checkout@v3 + with: + repository: NilashishC/aap-gateway + token: ${{ secrets.AAP_GATEWAY_REPO_TOKEN }} + + - name: Checkout DAB branch if needed + env: + PR_BODY: ${{ github.event.pull_request.body }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: tools/scripts/get_dab_for_pr.py + + - name: Start the dev environment + run: COMPOSE_UP_OPTS='-d' make docker-compose + + - name: Install make + run: sudo apt install make + + - name: Install python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install requirements + run: pip3.11 install -r requirements/requirements_dev.txt ansible-core + + - uses: actions/checkout@v3 + with: + path: ansible-platform + + - name: Perform completeness tests + run: cd ansible-platform && make collection-test-completeness + docs: name: Check module doc strings runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 026b5508..fd79393d 100644 --- a/Makefile +++ b/Makefile @@ -79,3 +79,8 @@ collection-test: collection-install ## Run the collections test-integration check to see if all modules have integration tests collection-test-integration-check: ./tests/test_integration_check.py + + +## Run the collections test-completness check +collection-test-completeness: + ./tests/test_completeness.py From 2d3089469f105bff81f65dce562061f59a2e7c26 Mon Sep 17 00:00:00 2001 From: NilashishC Date: Wed, 23 Apr 2025 11:25:16 +0530 Subject: [PATCH 3/3] remove extra new line Signed-off-by: NilashishC --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index fd79393d..ea6f767d 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,6 @@ collection-test: collection-install collection-test-integration-check: ./tests/test_integration_check.py - ## Run the collections test-completness check collection-test-completeness: ./tests/test_completeness.py