Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 15 additions & 30 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
name: Integration tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
workflow_call:

jobs:
integration-test-microk8s:
name: Integration tests (microk8s)
strategy:
fail-fast: false
matrix:
tox-environments:
- integration-charm
- integration-scaling
- integration-upgrades
- integration-policy
- integration-usersync
runs-on: ubuntu-22.04
steps:
- name: Free disk space
uses: canonical/free-disk-space@main
with:
android: true
dotnet: true
haskell: true
- name: Checkout
uses: actions/checkout@v3
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.4/stable
provider: microk8s
microk8s-addons: "ingress storage dns rbac registry"
channel: 1.28-strict/stable
- name: Run integration tests
run: tox -e ${{ matrix.tox-environments }}
integration-tests:
uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main
secrets: inherit
with:
channel: 1.28-strict/stable
modules: '["test_charm.py", "test_policy.py", "test_usersync.py", "test_scaling.py", "test_upgrades.py"]'
juju-channel: 3.4/stable
self-hosted-runner: false
microk8s-addons: "dns ingress rbac storage metallb:10.15.119.2-10.15.119.4 registry"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
publish-to-edge:
publish:
uses: canonical/operator-workflows/.github/workflows/publish_charm.yaml@main
secrets: inherit
with:
Expand Down
16 changes: 16 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

"""Fixtures for charm tests."""

import pytest


def pytest_addoption(parser: pytest.Parser):
"""Parse additional pytest options.

Args:
parser: pytest command line parser.
"""
# The prebuilt charm file.
parser.addoption("--charm-file", action="append", default=[])
4 changes: 4 additions & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

"""Tests module."""
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest
import pytest_asyncio
from helpers import APP_NAME, METADATA, POSTGRES_NAME
from integration.helpers import APP_NAME, METADATA, POSTGRES_NAME
from pytest_operator.plugin import OpsTest

logger = logging.getLogger(__name__)
Expand Down
10 changes: 8 additions & 2 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

import pytest
import requests
from conftest import deploy # noqa: F401, pylint: disable=W0611
from helpers import APP_NAME, METADATA, NGINX_NAME, POSTGRES_NAME, get_unit_url
from integration.conftest import deploy # noqa: F401, pylint: disable=W0611
from integration.helpers import (
APP_NAME,
METADATA,
NGINX_NAME,
POSTGRES_NAME,
get_unit_url,
)
from pytest_operator.plugin import OpsTest

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest
from apache_ranger.client import ranger_client
from helpers import (
from integration.helpers import (
APP_NAME,
RANGER_AUTH,
TRINO_NAME,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest
import requests
from helpers import APP_NAME, get_application_url, scale
from integration.helpers import APP_NAME, get_application_url, scale
from pytest_operator.plugin import OpsTest

logger = logging.getLogger(__name__)
Expand Down
8 changes: 7 additions & 1 deletion tests/integration/test_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
import pytest_asyncio
import requests
import yaml
from helpers import APP_NAME, METADATA, POSTGRES_NAME, SECURE_PWD, get_unit_url
from integration.helpers import (
APP_NAME,
METADATA,
POSTGRES_NAME,
SECURE_PWD,
get_unit_url,
)
from pytest_operator.plugin import OpsTest

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_usersync.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import time

import pytest
from helpers import (
from integration.helpers import (
APP_NAME,
LDAP_NAME,
METADATA,
Expand Down
Loading