Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 2.71 KB

integration_test_allure.md

File metadata and controls

64 lines (43 loc) · 2.71 KB

How to set up Allure Reports for integration tests

This how-to guide describes how to integrate Allure Reports into your code repository's integration_test_run.yaml.

Adding allure-pytest and pytest collection plugin

Include the following snippet in the requirements.txt that is called by the integration test:

allure-pytest>=2.8.18

Add the following line under the dependencies (deps) in the integration section inside tox.ini:

git+https://github.com/canonical/operator-workflows@main\#subdirectory=python/pytest_plugins/allure_pytest_collection_report

Calling the allure-workflow

To call the reusable workflow allure_report.yaml, add the following lines at the end of the workflow that runs the integrations tests:

  allure-report:
    if: always() && !cancelled()
    needs:
      - [list of jobs that call integration_test workflow whose tests you would like to visualize]
    uses: canonical/operator-workflows/.github/workflows/allure_report.yaml@main

For an example of this implementation, see the GitHub runner repository.

NOTE: If the workflow is being called inside a matrix with the same test modules run with different parameters, the Allure Report will only display the results of the last combination.

Changing branch permissions

NOTE: For this step, you need admin access to the repository.

If your repository is configured to have signed commits for all branches by default, you need to create a seperate protection rule for the gh-pages branch with the signed commits disabled.

  • Go to the repository's Settings > Branches and next to Branch protection rules, select Add rule
  • Enter the branch name gh-pages and click Save changes (Ensure that "require signed commits" is unchecked)

Github pages branch

  • Create gh-pages branch:
# For first run, manually create branch with no history 
 # (e.g. 
 # git checkout --orphan gh-pages
 # git rm -rf . 
 # touch .nojekyll 
 # git add .nojekyll 
 # git commit -m "Initial commit" 
 # git push origin gh-pages
 # ) 
  • Enable GitHub pages publishing at ** Settings > Pages ** and set branch name as gh-pages:
image

For an example of the first two steps, see the GitHub runner repository.