From 7a51f8dbf55ba21797a37358d9311c3aab813c29 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Fri, 28 Feb 2025 15:04:29 +0100 Subject: [PATCH 1/3] Install proper version of bind9.18-utils on RHEL9 Signed-off-by: Petr "Stone" Hracek --- 8.4/Dockerfile.rhel9 | 2 +- test/run | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/8.4/Dockerfile.rhel9 b/8.4/Dockerfile.rhel9 index e0c4572..6340f06 100644 --- a/8.4/Dockerfile.rhel9 +++ b/8.4/Dockerfile.rhel9 @@ -41,7 +41,7 @@ EXPOSE 3306 # safe in the future. This should *never* change, the last test is there # to make sure of that. RUN yum -y module enable mysql:$MYSQL_VERSION && \ - INSTALL_PKGS="policycoreutils rsync tar gettext hostname bind-utils groff-base mysql-server" && \ + INSTALL_PKGS="policycoreutils rsync tar gettext hostname bind9.18-utils groff-base mysql-server" && \ dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ dnf -y clean all --enablerepo='*' && \ diff --git a/test/run b/test/run index 5c47671..188f584 100755 --- a/test/run +++ b/test/run @@ -19,7 +19,6 @@ run_general_tests run_change_password_test run_change_password_new_user_test run_replication_test -run_doc_test run_s2i_test run_ssl_test run_datadir_actions_test From 3b006215bf2dfc16f30a9da3998f66bfb4cdea07 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 3 Mar 2025 09:49:42 +0100 Subject: [PATCH 2/3] Let's check all versions and not only the one. Signed-off-by: Petr "Stone" Hracek --- test/test_mysql_imagestream.py | 2 +- test/test_mysql_imagestream_template.py | 2 +- test/test_mysql_local_template.py | 2 +- test/test_mysql_shared_helm_imagestreams.py | 2 +- test/test_mysql_shared_helm_template.py | 13 ++++++++++--- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/test/test_mysql_imagestream.py b/test/test_mysql_imagestream.py index d41d873..b1f2c29 100644 --- a/test/test_mysql_imagestream.py +++ b/test/test_mysql_imagestream.py @@ -24,7 +24,7 @@ class TestMySQLImagestreamTemplate: def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION) + self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION, shared_cluster=True) def teardown_method(self): self.oc_api.delete_project() diff --git a/test/test_mysql_imagestream_template.py b/test/test_mysql_imagestream_template.py index 4cd3e5b..09cc3b2 100644 --- a/test/test_mysql_imagestream_template.py +++ b/test/test_mysql_imagestream_template.py @@ -24,7 +24,7 @@ class TestMySQLImagestreamTemplate: def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION) + self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION, shared_cluster=True) def teardown_method(self): self.oc_api.delete_project() diff --git a/test/test_mysql_local_template.py b/test/test_mysql_local_template.py index fc3f07d..291bbd9 100644 --- a/test/test_mysql_local_template.py +++ b/test/test_mysql_local_template.py @@ -25,7 +25,7 @@ class TestMySQLDeployTemplate: def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix="mysql-testing", version=VERSION) + self.oc_api = OpenShiftAPI(pod_name_prefix="mysql-testing", version=VERSION, shared_cluster=True) self.oc_api.import_is("imagestreams/mysql-rhel.json", "", skip_check=True) def teardown_method(self): diff --git a/test/test_mysql_shared_helm_imagestreams.py b/test/test_mysql_shared_helm_imagestreams.py index 668eebf..f84171c 100644 --- a/test/test_mysql_shared_helm_imagestreams.py +++ b/test/test_mysql_shared_helm_imagestreams.py @@ -13,7 +13,7 @@ class TestHelmRHELMySQLImageStreams: def setup_method(self): package_name = "redhat-mysql-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" diff --git a/test/test_mysql_shared_helm_template.py b/test/test_mysql_shared_helm_template.py index b4e2669..fc41091 100644 --- a/test/test_mysql_shared_helm_template.py +++ b/test/test_mysql_shared_helm_template.py @@ -13,7 +13,7 @@ class TestHelmMySQLDBPersistent: def setup_method(self): package_name = "redhat-mysql-persistent" 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" @@ -22,12 +22,19 @@ def setup_method(self): def teardown_method(self): self.hc_api.delete_project() - def test_package_persistent(self): + @pytest.mark.parametrize( + "version", + [ + "8.0-el8", + "8.0-el9", + ], + ) + def test_package_persistent(self, version): self.hc_api.package_name = "redhat-mysql-imagestreams" assert self.hc_api.helm_package() assert self.hc_api.helm_installation() self.hc_api.package_name = "redhat-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.helm_installation(values={"mysql_version": version, "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"]) From e65d310c6f062fcd31158ba87142ec5acabd8490 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 3 Mar 2025 15:20:11 +0100 Subject: [PATCH 3/3] Do not tests MySQL-84 in OpenShift tests yet;) It is not shipped Also test only examples on local cluster and not on shared_cluster Signed-off-by: Petr "Stone" Hracek --- test/test_mysql_imagestream.py | 8 ++++++-- test/test_mysql_imagestream_template.py | 7 ++++++- test/test_mysql_local_template.py | 4 +++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/test/test_mysql_imagestream.py b/test/test_mysql_imagestream.py index b1f2c29..f7e4502 100644 --- a/test/test_mysql_imagestream.py +++ b/test/test_mysql_imagestream.py @@ -24,7 +24,7 @@ class TestMySQLImagestreamTemplate: def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION, shared_cluster=True) + self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION) def teardown_method(self): self.oc_api.delete_project() @@ -37,8 +37,12 @@ def teardown_method(self): ] ) def test_imagestream_template(self, template): + if VERSION == "8.4": + # It is not shipped yet + pytest.skip("Skipping test for 8.4") + if self.oc_api.shared_cluster: + pytest.skip("Skipping test for shared cluster") os_name = ''.join(i for i in OS if not i.isdigit()) - print(os.getcwd()) assert self.oc_api.deploy_image_stream_template( imagestream_file=f"imagestreams/mysql-{os_name}.json", template_file=f"examples/{template}", diff --git a/test/test_mysql_imagestream_template.py b/test/test_mysql_imagestream_template.py index 09cc3b2..fec189a 100644 --- a/test/test_mysql_imagestream_template.py +++ b/test/test_mysql_imagestream_template.py @@ -24,7 +24,7 @@ class TestMySQLImagestreamTemplate: def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION, shared_cluster=True) + self.oc_api = OpenShiftAPI(pod_name_prefix="mysql", version=VERSION) def teardown_method(self): self.oc_api.delete_project() @@ -37,6 +37,11 @@ def teardown_method(self): ] ) def test_imagestream_template(self, template): + if VERSION == "8.4": + # It is not shipped yet + pytest.skip("Skipping test for 8.4") + if self.oc_api.shared_cluster: + pytest.skip("Skipping test for shared cluster") os_name = ''.join(i for i in OS if not i.isdigit()) assert self.oc_api.deploy_image_stream_template( imagestream_file=f"imagestreams/mysql-{os_name}.json", diff --git a/test/test_mysql_local_template.py b/test/test_mysql_local_template.py index 291bbd9..9b4fc76 100644 --- a/test/test_mysql_local_template.py +++ b/test/test_mysql_local_template.py @@ -25,7 +25,7 @@ class TestMySQLDeployTemplate: def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix="mysql-testing", version=VERSION, shared_cluster=True) + self.oc_api = OpenShiftAPI(pod_name_prefix="mysql-testing", version=VERSION) self.oc_api.import_is("imagestreams/mysql-rhel.json", "", skip_check=True) def teardown_method(self): @@ -39,6 +39,8 @@ def teardown_method(self): ] ) def test_template_inside_cluster(self, template): + if self.oc_api.shared_cluster: + pytest.skip("Skipping test for shared cluster") short_version = VERSION.replace(".", "") assert self.oc_api.deploy_template_with_image( image_name=IMAGE_NAME,