Skip to content

Commit

Permalink
Add support for testing helm charts present
Browse files Browse the repository at this point in the history
in https://github.com/sclorg/helm-charts repository

Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Sep 11, 2024
1 parent 754af65 commit 9278030
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/test_mysql_helm_imagestreams.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os

import pytest
from pathlib import Path

from container_ci_suite.helm import HelmChartsAPI

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))


class TestHelmRHELMySQLImageStreams:

def setup_method(self):
package_name = "mysql-imagestreams"
path = test_dir
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, remote=True)
self.hc_api.clone_helm_chart_repo(
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
subdir="charts/redhat"
)

def teardown_method(self):
self.hc_api.delete_project()

@pytest.mark.parametrize(
"version,registry",
[
("8.0-el9", "registry.redhat.io/rhel9/mysql-80:latest"),
("8.0-el8", "registry.redhat.io/rhel8/mysql-80:latest"),
],
)
def test_package_imagestream(self, version, registry):
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
assert self.hc_api.check_imagestreams(version=version, registry=registry)
33 changes: 33 additions & 0 deletions test/test_mysql_helm_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os

import pytest
from pathlib import Path

from container_ci_suite.helm import HelmChartsAPI

test_dir = Path(os.path.abspath(os.path.dirname(__file__)))


class TestHelmMySQLDBPersistent:

def setup_method(self):
package_name = "mysql-persistent"
path = test_dir
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, remote=True)
self.hc_api.clone_helm_chart_repo(
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
subdir="charts/redhat"
)

def teardown_method(self):
self.hc_api.delete_project()

def test_package_persistent(self):
self.hc_api.package_name = "mysql-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
self.hc_api.package_name = "mysql-persistent"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(values={".mysql_version": "8.0-el8", ".namespace": self.hc_api.namespace})
assert self.hc_api.is_pod_running(pod_name_prefix="mysql")
assert self.hc_api.test_helm_chart(expected_str=["42", "testval"])

0 comments on commit 9278030

Please sign in to comment.