Skip to content

Commit

Permalink
skip
Browse files Browse the repository at this point in the history
  • Loading branch information
DnPlas committed Dec 17, 2024
1 parent 17f6e5e commit c27158e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charms/kfp-api/tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TestCharm:
"""Integration test charm"""

@pytest.mark.abort_on_fail
async def test_build_and_deploy(self, ops_test: OpsTest):
async def test_build_and_deploy(self, ops_test: OpsTest, request):
"""Deploy kfp-api with required charms and relations."""

image_path = METADATA["resources"]["oci-image"]["upstream-source"]
Expand Down
12 changes: 12 additions & 0 deletions charms/kfp-metadata-writer/tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python3
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

from _pytest.config.argparsing import Parser


def pytest_addoption(parser: Parser):
parser.addoption(
"--charm-path",
help="Path to charm file when downloaded as artefact as a result of build_charm.yaml"
)
24 changes: 20 additions & 4 deletions charms/kfp-metadata-writer/tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,32 @@


@pytest.mark.abort_on_fail
async def test_build_and_deploy_with_relations(ops_test: OpsTest):
async def test_build_and_deploy_with_relations(ops_test: OpsTest, request):
built_charm_path = await ops_test.build_charm(CHARM_ROOT)
log.info(f"Built charm {built_charm_path}")

image_path = METADATA["resources"]["oci-image"]["upstream-source"]
resources = {"oci-image": image_path}

await ops_test.model.deploy(
entity_url=built_charm_path, application_name=APP_NAME, resources=resources, trust=True
)
if entity_url := request.config.getoption("--charm-path"):
await ops_test.model.deploy(
entity_url=entity_url,
application_name=APP_NAME,
resources=resources,
trust=True,
)
else:
# Keep the option to run the integration tests locally
# by building the charm and then deploying
built_charm_path = await ops_test.build_charm("./")
logger.info(f"Built charm {built_charm_path}")
await ops_test.model.deploy(
entity_url=built_charm_path,
application_name=APP_NAME,
resources=resources,
trust=True,
)

await ops_test.model.deploy(entity_url=MLMD, channel=MLMD_CHANNEL, trust=True)
await ops_test.model.integrate(f"{MLMD}:grpc", f"{APP_NAME}:grpc")
await ops_test.model.wait_for_idle(apps=[APP_NAME, MLMD], status="active", timeout=10 * 60)
Expand Down

0 comments on commit c27158e

Please sign in to comment.