Skip to content

Commit

Permalink
run tests as separate jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Jul 18, 2024
1 parent 3526fdc commit e2de378
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 32 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,29 @@ jobs:
name: Build rock
uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v16

collect-tests:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate matrix with all tests
id: set-matrix
run: |
echo "matrix=$(find tests/integration/ -name "test_*.py" | jq -R -s -c 'split("\n")[:-1]')"
echo "matrix=$(find tests/integration/ -name "test_*.py" | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
integration:
runs-on: ubuntu-latest
timeout-minutes: 120
needs: build
needs:
- build
- collect-tests
strategy:
matrix:
env: [integration]
file: ${{ fromJson(needs.collect-tests.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout repository
Expand Down Expand Up @@ -50,7 +66,8 @@ jobs:
pipx install poetry
- name: Integration Tests
run: |
sg snap_microk8s -c "tox -e ${{ matrix.env }}"
echo "Running test ${{ matrix.file }}"
sg snap_microk8s -c "tox -e ${{ matrix.file }}"
- name: Free disk space
run: |
echo "Free disk space after int tests"
Expand Down
29 changes: 0 additions & 29 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,3 @@ commands =
bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {env:branch} {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration -- --keep-models


[testenv:ha-integration]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f {env:name}_*-$(yq .base rockcraft.yaml | cut -c 8-)_edge_amd64.rock ]; \
then rockcraft pack; ./retag_rock.sh; fi'
bash -ec 'microk8s ctr image import {env:name}_*-$(yq .base rockcraft.yaml | \
cut -c 8-)_edge_amd64.rock --base-name {env:registry_namespace}/{env:name}'
bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {env:branch} {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e ha-integration -- --keep-models


[testenv:tls-integration]
description = run operator integration tests
skip_install = true
allowlist_externals =
tox
bash
commands =
bash -ec 'if ! [ -f {env:name}_*-$(yq .base rockcraft.yaml | cut -c 8-)_edge_amd64.rock ]; \
then rockcraft pack; ./retag_rock.sh; fi'
bash -ec 'microk8s ctr image import {env:name}_*-$(yq .base rockcraft.yaml | \
cut -c 8-)_edge_amd64.rock --base-name {env:registry_namespace}/{env:name}'
bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {env:branch} {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e tls-integration

0 comments on commit e2de378

Please sign in to comment.