-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add integration tests
- Loading branch information
Showing
12 changed files
with
538 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Integration tests | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
integration-tests: | ||
uses: canonical/operator-workflows/.github/workflows/integration_test.yaml@main | ||
secrets: inherit | ||
with: | ||
channel: 1.28-strict/stable | ||
modules: '["test_charm.py"]' | ||
juju-channel: 3.1/stable | ||
self-hosted-runner: true | ||
self-hosted-runner-label: "xlarge" | ||
microk8s-addons: "dns ingress rbac storage metallb:10.15.119.2-10.15.119.4 registry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
"""Tests module.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
"""Fixtures for jenkins-k8s 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=[]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
"""Charm integration test config.""" | ||
|
||
import asyncio | ||
import logging | ||
|
||
import pytest_asyncio | ||
from helpers import ( | ||
APP_NAME_AIRBYTE_SERVER, | ||
APP_NAME_TEMPORAL_ADMIN, | ||
APP_NAME_TEMPORAL_SERVER, | ||
create_default_namespace, | ||
get_airbyte_charm_resources, | ||
perform_airbyte_integrations, | ||
perform_temporal_integrations, | ||
run_sample_workflow, | ||
) | ||
from pytest_operator.plugin import OpsTest | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@pytest_asyncio.fixture(name="deploy", scope="module") | ||
async def deploy(ops_test: OpsTest): | ||
"""Test the app is up and running.""" | ||
await ops_test.model.set_config({"update-status-hook-interval": "1m"}) | ||
|
||
charm = await ops_test.build_charm(".") | ||
resources = get_airbyte_charm_resources() | ||
|
||
await ops_test.model.deploy(charm, resources=resources, application_name=APP_NAME_AIRBYTE_SERVER, trust=True) | ||
await ops_test.model.deploy( | ||
APP_NAME_TEMPORAL_SERVER, | ||
channel="edge", | ||
config={"num-history-shards": 4}, | ||
) | ||
await ops_test.model.deploy(APP_NAME_TEMPORAL_ADMIN, channel="edge") | ||
await ops_test.model.deploy("postgresql-k8s", channel="14/edge", trust=True) | ||
await ops_test.model.deploy("minio", channel="edge") | ||
|
||
async with ops_test.fast_forward(): | ||
await ops_test.model.wait_for_idle( | ||
apps=["postgresql-k8s", "minio"], | ||
status="active", | ||
raise_on_blocked=False, | ||
timeout=1200, | ||
) | ||
await ops_test.model.wait_for_idle( | ||
apps=[APP_NAME_TEMPORAL_SERVER, APP_NAME_TEMPORAL_ADMIN], | ||
status="blocked", | ||
raise_on_blocked=False, | ||
timeout=600, | ||
) | ||
|
||
await perform_temporal_integrations(ops_test) | ||
await create_default_namespace(ops_test) | ||
await run_sample_workflow(ops_test) | ||
|
||
await perform_airbyte_integrations(ops_test) |
Oops, something went wrong.