generated from canonical/template-operator
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cache charmcraft pack container, skip unstable tests except on schedule
Ported from canonical/mysql-k8s-operator#146
- Loading branch information
1 parent
d225339
commit eac487f
Showing
10 changed files
with
136 additions
and
147 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
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2022 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
import json | ||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
from pytest_operator.plugin import OpsTest | ||
|
||
|
||
@pytest.fixture | ||
def ops_test(ops_test: OpsTest) -> OpsTest: | ||
if os.environ.get("CI") == "true": | ||
# Running in GitHub Actions; skip build step | ||
# (GitHub Actions uses a separate, cached build step. See .github/workflows/ci.yaml) | ||
packed_charms = json.loads(os.environ["CI_PACKED_CHARMS"]) | ||
|
||
async def build_charm(charm_path, bases_index: int = None) -> Path: | ||
for charm in packed_charms: | ||
if Path(charm_path) == Path(charm["directory_path"]): | ||
if bases_index is None or bases_index == charm["bases_index"]: | ||
return charm["file_path"] | ||
raise ValueError(f"Unable to find .charm file for {bases_index=} at {charm_path=}") | ||
|
||
ops_test.build_charm = build_charm | ||
return ops_test |
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
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
Oops, something went wrong.