-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update viewer-crd-controller to 2.2.0 (#91)
* Update viewer-crd-controller to 2.2.0
- Loading branch information
Showing
3 changed files
with
73 additions
and
14 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 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,56 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
import random | ||
import pytest | ||
import string | ||
import subprocess | ||
|
||
from charmed_kubeflow_chisme.rock import CheckRock | ||
|
||
|
||
@pytest.fixture() | ||
def rock_test_env(tmpdir): | ||
"""Yields a temporary directory and random docker container name, then cleans them up after.""" | ||
container_name = "".join( | ||
[str(i) for i in random.choices(string.ascii_lowercase, k=8)] | ||
) | ||
yield tmpdir, container_name | ||
|
||
subprocess.run(["docker", "rm", container_name], shell=True, check=False) | ||
# tmpdir fixture we use here should clean up the other files for us | ||
|
||
|
||
@pytest.mark.abort_on_fail | ||
def test_rock(rock_test_env): | ||
"""Test rock.""" | ||
temp_dir, container_name = rock_test_env | ||
check_rock = CheckRock("rockcraft.yaml") | ||
rock_image = check_rock.get_name() | ||
rock_version = check_rock.get_version() | ||
LOCAL_ROCK_IMAGE = f"{rock_image}:{rock_version}" | ||
|
||
# assert we have the expected files | ||
subprocess.run( | ||
[ | ||
"docker", | ||
"run", | ||
"--entrypoint", | ||
"/bin/bash", | ||
LOCAL_ROCK_IMAGE, | ||
"-c", | ||
"ls -la /bin/controller", | ||
], | ||
check=True, | ||
) | ||
subprocess.run( | ||
[ | ||
"docker", | ||
"run", | ||
"--entrypoint", | ||
"/bin/bash", | ||
LOCAL_ROCK_IMAGE, | ||
"-c", | ||
"ls -la /third_party", | ||
], | ||
check=True, | ||
) |
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