Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/run-openshift-remote-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ct_os_check_login || exit $OC_ERR

ct_os_tag_image_for_cvp "perl"

set -u
set -ux

# For testing on OpenShift 4 we use internal registry
export CT_OCP4_TEST=true
Expand Down
4 changes: 4 additions & 0 deletions test/test-lib-perl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function test_perl_imagestream() {
if [ "${VERSION}" == "5.26-mod_fcgid" ]; then
VERSION="5.26"
fi
if [ "${OS}" == "rhel10" ]; then
echo "Skip testing imagestreams on RHEL10 till they are not available."
return
fi
echo "Testing perl imagestream application"
ct_os_test_image_stream_quickstart "${THISDIR}/imagestreams/perl-${OS%[0-9]*}.json" \
"${THISDIR}/sample-test-app.json" \
Expand Down
10 changes: 8 additions & 2 deletions test/test_dancer_ex_standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
IMAGE_NAME = os.getenv("IMAGE_NAME")
OS = os.getenv("TARGET")

if VERSION == "5.30-mod_fcgid":
VERSION = "5.30"

if VERSION == "5.26-mod_fcgid":
VERSION = "5.26"

# Replacement with 'test_python_s2i_app_ex'
class TestPerlDancerExTemplate:
Expand All @@ -26,13 +31,14 @@ def teardown_method(self):
self.oc_api.delete_project()

def test_dancer_ex_template_inside_cluster(self):
service_name = "perl-testing"
new_version = VERSION.replace(".", "")
service_name = f"perl-{new_version}-testing"
assert self.oc_api.deploy_s2i_app(
image_name=IMAGE_NAME, app="https://github.com/sclorg/dancer-ex.git",
context=".",
service_name=service_name
)
assert self.oc_api.template_deployed(name_in_template=service_name)
assert self.oc_api.is_s2i_pod_running(pod_name_prefix=service_name, cycle_count=480)
assert self.oc_api.check_response_inside_cluster(
name_in_template=service_name, expected_output="Welcome to your Dancer application on OpenShift"
)
30 changes: 21 additions & 9 deletions test/test_dancer_ex_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,37 @@
IMAGE_NAME = os.getenv("IMAGE_NAME")
OS = os.getenv("TARGET")

if VERSION == "5.30-mod_fcgid":
VERSION = "5.30"

if VERSION == "5.26-mod_fcgid":
VERSION = "5.26"

DEPLOYED_MYSQL_IMAGE = "quay.io/sclorg/mysql-80-c9s:c9s"

MYSQL_TAGS = {
"rhel8": "-el8",
"rhel9": "-el9"
"rhel9": "-el9",
"rhel10": "-el10",
}
MYSQL_TAG = MYSQL_TAGS.get(OS, None)
IMAGE_TAG = f"mysql:8.0{MYSQL_TAG}"
MYSQL_VERSION = f"8.0{MYSQL_TAG}"

TEMPLATE_VERSION = VERSION.replace(".", "")

class TestDeployDancerExTemplateWithoutMySQL:

def setup_method(self):
self.oc_api = OpenShiftAPI(pod_name_prefix="perl-testing", version=VERSION)
self.oc_api.import_is("imagestreams/perl-rhel.json", "", skip_check=True)
self.oc_api = OpenShiftAPI(pod_name_prefix=f"perl-{TEMPLATE_VERSION}-testing", version=VERSION)

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

def test_perl_template_inside_cluster(self):
service_name = "perl-testing"
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
self.oc_api.import_is("imagestreams/perl-rhel.json", "", skip_check=True)
service_name = f"perl-{TEMPLATE_VERSION}-testing"
template_url = self.oc_api.get_raw_url_for_json(
container="dancer-ex", dir="openshift/templates", filename="dancer.json", branch="master"
)
Expand All @@ -49,7 +58,7 @@ def test_perl_template_inside_cluster(self):
"SOURCE_REPOSITORY_REF=master"
]
)
assert self.oc_api.template_deployed(name_in_template=service_name)
assert self.oc_api.is_template_deployed(name_in_template=service_name, timeout=480)
assert self.oc_api.check_response_inside_cluster(
name_in_template=service_name, expected_output="Welcome to your Dancer application on OpenShift"
)
Expand All @@ -58,15 +67,18 @@ def test_perl_template_inside_cluster(self):
class TestDeployDancerExTemplateWithMySQL:

def setup_method(self):
self.oc_api = OpenShiftAPI(pod_name_prefix="perl-testing", version=VERSION)

self.oc_api = OpenShiftAPI(pod_name_prefix=f"perl-{TEMPLATE_VERSION}-testing", version=VERSION)
self.oc_api.import_is("imagestreams/perl-rhel.json", "", skip_check=True)
assert self.oc_api.upload_image(DEPLOYED_MYSQL_IMAGE, f"{IMAGE_TAG}")

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

def test_perl_template_inside_cluster(self):
service_name = "perl-testing"
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
service_name = f"perl-{TEMPLATE_VERSION}-testing"
template_url = self.oc_api.get_raw_url_for_json(
container="dancer-ex", dir="openshift/templates", filename="dancer-mysql-persistent.json", branch="master"
)
Expand All @@ -82,7 +94,7 @@ def test_perl_template_inside_cluster(self):

]
)
assert self.oc_api.template_deployed(name_in_template=service_name)
assert self.oc_api.is_template_deployed(name_in_template=service_name, timeout=480)
assert self.oc_api.check_response_inside_cluster(
name_in_template=service_name, expected_output="Welcome to your Dancer application on OpenShift"
)
12 changes: 11 additions & 1 deletion test/test_deploy_templates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import sys

import pytest

from container_ci_suite.openshift import OpenShiftAPI
from container_ci_suite.utils import check_variables

Expand All @@ -13,6 +15,12 @@
IMAGE_NAME = os.getenv("IMAGE_NAME")
OS = os.getenv("TARGET")

if VERSION == "5.30-mod_fcgid":
VERSION = "5.30"

if VERSION == "5.26-mod_fcgid":
VERSION = "5.26"


class TestDeployTemplate:

Expand All @@ -24,6 +32,8 @@ def teardown_method(self):
self.oc_api.delete_project()

def test_perl_template_inside_cluster(self):
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
service_name = "perl-testing"
assert self.oc_api.deploy_template_with_image(
image_name=IMAGE_NAME,
Expand All @@ -35,7 +45,7 @@ def test_perl_template_inside_cluster(self):
f"NAME={service_name}"
]
)
assert self.oc_api.template_deployed(name_in_template=service_name)
assert self.oc_api.is_template_deployed(name_in_template=service_name, timeout=480)
assert self.oc_api.check_response_inside_cluster(
name_in_template=service_name, expected_output="Everything is OK"
)
7 changes: 6 additions & 1 deletion test/test_helm_dancer_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

TAGS = {
"rhel8": "-ubi8",
"rhel9": "-ubi9"
"rhel9": "-ubi9",
"rhel10": "-ubi10",
}
TAG = TAGS.get(OS, None)

Expand All @@ -48,6 +49,8 @@ def teardown_method(self):
def test_dancer_application_curl_output(self):
if self.hc_api.oc_api.shared_cluster:
pytest.skip("Do NOT test on shared cluster")
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
self.hc_api.package_name = "redhat-perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
Expand All @@ -66,6 +69,8 @@ def test_dancer_application_curl_output(self):
)

def test_dancer_application_helm_test(self):
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
self.hc_api.package_name = "redhat-perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
Expand Down
11 changes: 8 additions & 3 deletions test/test_helm_dancer_mysql_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

TAGS = {
"rhel8": "-ubi8",
"rhel9": "-ubi9"
"rhel9": "-ubi9",
"rhel10": "-ubi10",
}
TAG = TAGS.get(OS, None)

Expand All @@ -47,6 +48,8 @@ def teardown_method(self):
def test_dancer_application(self):
if self.hc_api.oc_api.shared_cluster:
pytest.skip("Do NOT test on shared cluster")
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
self.hc_api.package_name = "redhat-perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
Expand All @@ -58,14 +61,16 @@ def test_dancer_application(self):
"namespace": self.hc_api.namespace
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=400)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=480)
assert self.hc_api.oc_api.check_response_inside_cluster(
name_in_template="dancer-example",
expected_output="Welcome to your Dancer application"
)


def test_dancer_application_helm_test(self):
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
self.hc_api.package_name = "redhat-perl-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
Expand All @@ -77,5 +82,5 @@ def test_dancer_application_helm_test(self):
"namespace": self.hc_api.namespace
}
)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=400)
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=480)
assert self.hc_api.test_helm_chart(expected_str=["Welcome to your Dancer application"])
2 changes: 1 addition & 1 deletion test/test_helm_perl_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestHelmRHELPerlImageStreams:
def setup_method(self):
package_name = "redhat-perl-imagestreams"
path = test_dir
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True)
self.hc_api.clone_helm_chart_repo(
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
subdir="charts/redhat"
Expand Down
19 changes: 12 additions & 7 deletions test/test_imagestreams_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@
OS = os.getenv("OS")

TAGS = {
"rhel7": "-ubi7",
"rhel8": "-ubi8",
"rhel9": "-ubi9"
"rhel9": "-ubi9",
"rhel10": "-ubi10"
}

TAG = TAGS.get(OS, None)

if VERSION == "5.30-mod_fcgid":
VERSION = "5.30"

if VERSION == "5.26-mod_fcgid":
VERSION = "5.26"


# Replacement with 'test_python_s2i_templates'
class TestImagestreamsQuickstart:
Expand All @@ -35,9 +41,8 @@ def teardown_method(self):
self.oc_api.delete_project()

def test_perl_template_inside_cluster(self):
new_version = VERSION
if VERSION == "5.26-mod_fcgid":
new_version = "5.26"
if OS == "rhel10":
pytest.skip("Do NOT test on RHEL10 yet.")
service_name = "perl-testing"
assert self.oc_api.imagestream_quickstart(
imagestream_file="imagestreams/perl-rhel.json",
Expand All @@ -46,11 +51,11 @@ def test_perl_template_inside_cluster(self):
name_in_template="perl",
openshift_args=[
f"SOURCE_REPOSITORY_REF=master",
f"VERSION={new_version}{TAG}",
f"VERSION={VERSION}{TAG}",
f"NAME={service_name}"
]
)
assert self.oc_api.template_deployed(name_in_template=service_name)
assert self.oc_api.is_template_deployed(name_in_template=service_name, timeout=480)
assert self.oc_api.check_response_inside_cluster(
name_in_template=service_name, expected_output="Everything is OK"
)