diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index b1d7f6b..0f6ff9f 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -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 @@ -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" diff --git a/tox.ini b/tox.ini index 1ed7ea3..07e905b 100644 --- a/tox.ini +++ b/tox.ini @@ -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