Skip to content

Commit

Permalink
Add support testig helm charts in Perl container
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
  • Loading branch information
phracek committed Sep 11, 2024
1 parent eb669dc commit 1054245
Show file tree
Hide file tree
Showing 24 changed files with 219 additions and 0 deletions.
1 change: 1 addition & 0 deletions 5.30-mod_fcgid/test/test_helm_dancer_app.py
1 change: 1 addition & 0 deletions 5.30-mod_fcgid/test/test_helm_dancer_mysql_template.py
1 change: 1 addition & 0 deletions 5.30-mod_fcgid/test/test_helm_perl_imagestreams.py
1 change: 1 addition & 0 deletions 5.30/test/test_helm_dancer_app.py
1 change: 1 addition & 0 deletions 5.30/test/test_helm_dancer_mysql_template.py
1 change: 1 addition & 0 deletions 5.30/test/test_helm_perl_imagestreams.py
1 change: 1 addition & 0 deletions 5.32/test/test_helm_dancer_app.py
1 change: 1 addition & 0 deletions 5.32/test/test_helm_dancer_mysql_template.py
1 change: 1 addition & 0 deletions 5.32/test/test_helm_perl_imagestreams.py
1 change: 1 addition & 0 deletions 5.34/test/test_helm_dancer_app.py
1 change: 1 addition & 0 deletions 5.34/test/test_helm_dancer_mysql_template.py
1 change: 1 addition & 0 deletions 5.34/test/test_helm_perl_imagestreams.py
1 change: 1 addition & 0 deletions 5.36/test/test_helm_dancer_app.py
1 change: 1 addition & 0 deletions 5.36/test/test_helm_dancer_mysql_template.py
1 change: 1 addition & 0 deletions 5.36/test/test_helm_perl_imagestreams.py
1 change: 1 addition & 0 deletions 5.38/test/test_helm_dancer_app.py
1 change: 1 addition & 0 deletions 5.38/test/test_helm_dancer_mysql_template.py
1 change: 1 addition & 0 deletions 5.38/test/test_helm_perl_imagestreams.py
1 change: 1 addition & 0 deletions 5.40/test/test_helm_dancer_app.py
1 change: 1 addition & 0 deletions 5.40/test/test_helm_dancer_mysql_template.py
1 change: 1 addition & 0 deletions 5.40/test/test_helm_perl_imagestreams.py
65 changes: 65 additions & 0 deletions test/test_helm_dancer_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
import sys

import pytest

from pathlib import Path

from container_ci_suite.helm import HelmChartsAPI
from container_ci_suite.utils import check_variables

if not check_variables():
print("At least one variable from IMAGE_NAME, OS, VERSION is missing.")
sys.exit(1)

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


class TestHelmPerlDancerAppTemplate:

def setup_method(self):
package_name = "perl-dancer-application"
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_dancer_application_curl_output(self):
if self.hc_api.oc_api.shared_cluster:
pytest.skip("Do NOT test on shared cluster")
self.hc_api.package_name = "perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
self.hc_api.package_name = "perl-dancer-application"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"perl_version": "5.32-ubi8",
"namespace": self.hc_api.namespace
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example")
assert self.hc_api.test_helm_curl_output(
route_name="dancer-example",
expected_str="Welcome to your Dancer application"
)

def test_dancer_application_helm_test(self):
self.hc_api.package_name = "perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
self.hc_api.package_name = "perl-dancer-application"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"perl_version": "5.32-ubi8",
"namespace": self.hc_api.namespace
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example")
assert self.hc_api.test_helm_chart(expected_str=["Welcome to your Dancer application"])
66 changes: 66 additions & 0 deletions test/test_helm_dancer_mysql_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import os
import sys

import pytest

from pathlib import Path

from container_ci_suite.helm import HelmChartsAPI
from container_ci_suite.utils import check_variables

if not check_variables():
print("At least one variable from IMAGE_NAME, OS, VERSION is missing.")
sys.exit(1)

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


class TestHelmPerlDancerMysqlAppTemplate:

def setup_method(self):
package_name = "perl-dancer-application"
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_dancer_application(self):
if self.hc_api.oc_api.shared_cluster:
pytest.skip("Do NOT test on shared cluster")
self.hc_api.package_name = "perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
self.hc_api.package_name = "perl-dancer-application"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"perl_version": "5.32-ubi8",
"namespace": self.hc_api.namespace
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example")
assert self.hc_api.test_helm_curl_output(
route_name="dancer-example",
expected_str="Welcome to your Dancer application"
)


def test_dancer_application_helm_test(self):
self.hc_api.package_name = "perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
self.hc_api.package_name = "perl-dancer-application"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(
values={
"perl_version": "5.32-ubi8",
"namespace": self.hc_api.namespace
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example")
assert self.hc_api.test_helm_chart(expected_str=["Welcome to your Dancer application"])
67 changes: 67 additions & 0 deletions test/test_helm_perl_imagestreams.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import os
import sys

import pytest

from pathlib import Path

from container_ci_suite.helm import HelmChartsAPI
from container_ci_suite.utils import check_variables

if not check_variables():
print("At least one variable from IMAGE_NAME, OS, VERSION is missing.")
sys.exit(1)

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


class TestHelmRHELPerlImageStreams:

def setup_method(self):
package_name = "perl-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",
[
("5.32-ubi9", "registry.redhat.io/ubi9/perl-532:latest"),
("5.32-ubi8", "registry.redhat.io/ubi8/perl-532:latest"),
("5.26-ubi8", "registry.redhat.io/ubi8/perl-526: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)


class TestHelmCentOSPerlImageStreams:

def setup_method(self):
package_name = "perl-imagestreams"
path = test_dir / "../charts/centos"
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)

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

@pytest.mark.parametrize(
"version,registry",
[
("5.32-ubi9", "registry.access.redhat.com/ubi9/perl-532:latest"),
("5.32-ubi8", "registry.access.redhat.com/ubi8/perl-532:latest"),
("5.26-ubi8", "registry.access.redhat.com/ubi8/perl-526: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)

0 comments on commit 1054245

Please sign in to comment.