diff --git a/.github/workflows/frontend_charm_integration_tests.yml b/.github/workflows/frontend_charm_integration_tests.yml index 25305d0ff..4ac1338e9 100644 --- a/.github/workflows/frontend_charm_integration_tests.yml +++ b/.github/workflows/frontend_charm_integration_tests.yml @@ -1,45 +1,37 @@ -name: Run charm tests +name: Run charm integration tests on: + pull_request_review: + on: + pull_request_review: + types: [submitted] + pull_request: + branches: + - '**' + paths: + - 'frontend/charm/**' push: branches: ["main"] tags: ["v*.*.*"] + workflow_dispatch: jobs: integration-test: + permissions: + contents: read + packages: read + name: Integration tests - runs-on: [self-hosted, linux, large] + runs-on: [self-hosted, jammy, xlarge] + if: github.event.review.state == 'APPROVED' steps: - name: Checkout - uses: actions/checkout@v3 - - name: Setup LXD - uses: canonical/setup-lxd@main - with: - channel: 5.13/stable - - name: Setup operator environment - uses: charmed-kubernetes/actions-operator@main - with: - provider: microk8s + uses: actions/checkout@v4 + - name: Set up microk8s + uses: canonical/certification-github-workflows/.github/actions/microk8s-setup@main - name: Run integration tests run: tox -e integration - - name: Archive Tested Charm - uses: actions/upload-artifact@v3 - if: ${{ github.ref_name == 'main' }} - with: - name: tested-charm - path: .tox/**/test-observer-frontend_ubuntu-22.04-amd64.charm - retention-days: 5 - - name: Archive charmcraft logs - if: failure() - uses: actions/upload-artifact@v3 - with: - name: charmcraft-logs - path: /home/runner/.local/state/charmcraft/log/*.log - - name: Archive juju crashdump - if: failure() - uses: actions/upload-artifact@v3 - with: - name: juju-crashdump - path: juju-crashdump-*.tar.xz + - name: Archive charm testing outputs + uses: canonical/certification-github-workflows/.github/actions/archive-charm-testing-artifacts@main defaults: run: - working-directory: ./frontend/charm \ No newline at end of file + working-directory: ./frontend/charm diff --git a/.github/workflows/publish_api.yml b/.github/workflows/publish_api.yml index 0f93ec5e7..1cb2982f4 100644 --- a/.github/workflows/publish_api.yml +++ b/.github/workflows/publish_api.yml @@ -8,7 +8,7 @@ env: jobs: build-and-push-image: - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] permissions: contents: read packages: write @@ -19,6 +19,10 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + config-inline: | + [registry."docker.io"] + mirrors = ["https://github-runner-dockerhub-cache.canonical.com:5000"] - name: Checkout repository uses: actions/checkout@v3 @@ -46,8 +50,8 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-and-push-charm: + runs-on: [self-hosted, linux, xlarge] needs: build-and-push-image - runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/publish_frontend.yml b/.github/workflows/publish_frontend.yml index fad0f411e..7e6ecd926 100644 --- a/.github/workflows/publish_frontend.yml +++ b/.github/workflows/publish_frontend.yml @@ -8,7 +8,7 @@ env: jobs: build-and-push-frontend-image: - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] permissions: contents: read packages: write @@ -19,6 +19,10 @@ jobs: steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + config-inline: | + [registry."docker.io"] + mirrors = ["https://github-runner-dockerhub-cache.canonical.com:5000"] - name: Checkout repository uses: actions/checkout@v3 diff --git a/README.md b/README.md index 60cf1b72e..8f875b6ba 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Observe the status and state of certification tests for various artefacts - `juju` 3.1 or later (`sudo snap install juju --channel=3.1/stable`) - `microk8s` 1.27 or later (`sudo snap install microk8s --channel=1.27-strict/stable`) + [permission setup steps after install](https://juju.is/docs/sdk/set-up-your-development-environment#heading--install-microk8s) - `terraform` 1.4.6 or later (`sudo snap install terraform --classic`) -- `lxd` 5.13 or later (`sudo snap install lxd --channel=5.13/stable` or `sudo snap refresh lxd --channel=5.13/stable` if already installed) + `lxd init --auto` after install. +- `lxd` 5.19 or later (`sudo snap install lxd --channel=5.19/stable` or `sudo snap refresh lxd --channel=5.19/stable` if already installed) + `lxd init --auto` after install. - `charmcraft` 2.3.0 or later (`sudo snap install charmcraft --channel=2.x/stable --classic`) - optional: `jhack` for all kinds of handy Juju and charm SDK development and debugging operations (`sudo snap install jhack`) diff --git a/backend/charm/requirements.txt b/backend/charm/requirements.txt index 398fee13d..60f27e45d 100644 --- a/backend/charm/requirements.txt +++ b/backend/charm/requirements.txt @@ -1,2 +1,2 @@ -ops >= 1.5.0 +ops >= 2.8.0 requests==2.31.0 diff --git a/frontend/charm/requirements.txt b/frontend/charm/requirements.txt index aaa16b155..84a2a12dd 100644 --- a/frontend/charm/requirements.txt +++ b/frontend/charm/requirements.txt @@ -1 +1,2 @@ -ops >= 2.2.0 +ops >= 2.8.0 +macaroonbakery==1.3.2 # workaround to failures such as https://github.com/canonical/test_observer/actions/runs/7142353669/job/19451476954 \ No newline at end of file diff --git a/frontend/charm/tests/integration/test_charm.py b/frontend/charm/tests/integration/test_charm.py index 10742f61b..77cc33f3a 100644 --- a/frontend/charm/tests/integration/test_charm.py +++ b/frontend/charm/tests/integration/test_charm.py @@ -17,8 +17,8 @@ @pytest.mark.abort_on_fail -async def test_build_and_deploy(ops_test: OpsTest): - """Build the charm-under-test and deploy it together with related charms. +async def test_build_and_deploy_without_backend(ops_test: OpsTest): + """Build the charm-under-test and deploy it together without related charms. Assert on the unit status before any relations/configurations take place. """ @@ -29,8 +29,7 @@ async def test_build_and_deploy(ops_test: OpsTest): ops_test.model.deploy(charm, resources=resources, application_name=APP_NAME), ops_test.model.wait_for_idle( apps=[APP_NAME], - status="active", - raise_on_blocked=True, - timeout=1000, + status="maintenance", + timeout=2000, ), ) diff --git a/frontend/charm/tox.ini b/frontend/charm/tox.ini index 0add52053..954ee8c0b 100644 --- a/frontend/charm/tox.ini +++ b/frontend/charm/tox.ini @@ -66,7 +66,7 @@ commands = description = Run integration tests deps = pytest - juju + juju<=3.2 pytest-operator -r {tox_root}/requirements.txt commands = diff --git a/terraform/test-observer.tf b/terraform/test-observer.tf index 5ba789166..819aed2d5 100644 --- a/terraform/test-observer.tf +++ b/terraform/test-observer.tf @@ -1,7 +1,7 @@ terraform { required_providers { juju = { - version = "~> 0.7.0" + version = "~> 0.10.0" source = "juju/juju" } } @@ -67,7 +67,6 @@ resource "juju_application" "pg" { charm { name = "postgresql-k8s" channel = "14/stable" - series = "jammy" } } @@ -78,7 +77,6 @@ resource "juju_application" "test-observer-api" { charm { name = "test-observer-api" channel = "latest/edge" - series = "jammy" } config = { @@ -97,7 +95,6 @@ resource "juju_application" "test-observer-frontend" { charm { name = "test-observer-frontend" channel = "latest/edge" - series = "jammy" } config = {