From 582b466eaf30e879eeea48fe78b48db7008669bd Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Thu, 6 Nov 2025 16:13:08 +0100 Subject: [PATCH 1/7] Rename OpenShift PyTest files to `test_ocp_*`.py Signed-off-by: Petr "Stone" Hracek --- 2.5/test/constants.py | 1 - 2.5/test/test_helm_ruby_imagestreams.py | 1 - 2.5/test/test_helm_ruby_rails_application.py | 1 - 2.5/test/test_ocp_helm_ruby_imagestreams.py | 1 + 2.5/test/test_ocp_helm_ruby_rails_application.py | 1 + 2.5/test/test_ocp_ruby_ex_standalone.py | 1 + 2.5/test/test_ocp_ruby_latest_imagestreams.py | 1 + 2.5/test/test_ocp_s2i_imagestreams.py | 1 + 2.5/test/test_ocp_s2i_integration.py | 1 + 2.5/test/test_ocp_s2i_local_templates.py | 1 + 2.5/test/test_ocp_s2i_rails_ex_templates.py | 1 + 2.5/test/test_ruby_ex_standalone.py | 1 - 2.5/test/test_ruby_latest_imagestreams.py | 1 - 2.5/test/test_s2i_imagestreams.py | 1 - 2.5/test/test_s2i_integration.py | 1 - 2.5/test/test_s2i_local_templates.py | 1 - 2.5/test/test_s2i_rails_ex_templates.py | 1 - 3.0/test/constants.py | 1 - 3.0/test/test_helm_ruby_imagestreams.py | 1 - 3.0/test/test_helm_ruby_rails_application.py | 1 - 3.0/test/test_ocp_helm_ruby_imagestreams.py | 1 + 3.0/test/test_ocp_helm_ruby_rails_application.py | 1 + 3.0/test/test_ocp_ruby_ex_standalone.py | 1 + 3.0/test/test_ocp_ruby_latest_imagestreams.py | 1 + 3.0/test/test_ocp_s2i_imagestreams.py | 1 + 3.0/test/test_ocp_s2i_integration.py | 1 + 3.0/test/test_ocp_s2i_local_templates.py | 1 + 3.0/test/test_ocp_s2i_rails_ex_templates.py | 1 + 3.0/test/test_ruby_ex_standalone.py | 1 - 3.0/test/test_ruby_latest_imagestreams.py | 1 - 3.0/test/test_s2i_imagestreams.py | 1 - 3.0/test/test_s2i_integration.py | 1 - 3.0/test/test_s2i_local_templates.py | 1 - 3.0/test/test_s2i_rails_ex_templates.py | 1 - 3.1/test/constants.py | 1 - 3.1/test/test_helm_ruby_imagestreams.py | 1 - 3.1/test/test_helm_ruby_rails_application.py | 1 - 3.1/test/test_ocp_helm_ruby_imagestreams.py | 1 + 3.1/test/test_ocp_helm_ruby_rails_application.py | 1 + 3.1/test/test_ocp_ruby_ex_standalone.py | 1 + 3.1/test/test_ocp_ruby_latest_imagestreams.py | 1 + 3.1/test/test_ocp_s2i_imagestreams.py | 1 + 3.1/test/test_ocp_s2i_integration.py | 1 + 3.1/test/test_ocp_s2i_local_templates.py | 1 + 3.1/test/test_ocp_s2i_rails_ex_templates.py | 1 + 3.1/test/test_ruby_ex_standalone.py | 1 - 3.1/test/test_ruby_latest_imagestreams.py | 1 - 3.1/test/test_s2i_imagestreams.py | 1 - 3.1/test/test_s2i_integration.py | 1 - 3.1/test/test_s2i_local_templates.py | 1 - 3.1/test/test_s2i_rails_ex_templates.py | 1 - 3.3/test/constants.py | 1 - 3.3/test/test_helm_ruby_imagestreams.py | 1 - 3.3/test/test_helm_ruby_rails_application.py | 1 - 3.3/test/test_ocp_helm_ruby_imagestreams.py | 1 + 3.3/test/test_ocp_helm_ruby_rails_application.py | 1 + 3.3/test/test_ocp_ruby_ex_standalone.py | 1 + 3.3/test/test_ocp_ruby_latest_imagestreams.py | 1 + 3.3/test/test_ocp_s2i_imagestreams.py | 1 + 3.3/test/test_ocp_s2i_integration.py | 1 + 3.3/test/test_ocp_s2i_local_templates.py | 1 + 3.3/test/test_ocp_s2i_rails_ex_templates.py | 1 + 3.3/test/test_ruby_ex_standalone.py | 1 - 3.3/test/test_ruby_latest_imagestreams.py | 1 - 3.3/test/test_s2i_imagestreams.py | 1 - 3.3/test/test_s2i_integration.py | 1 - 3.3/test/test_s2i_local_templates.py | 1 - 3.3/test/test_s2i_rails_ex_templates.py | 1 - test/constants.py | 11 ----------- ...estreams.py => test_ocp_helm_ruby_imagestreams.py} | 0 ...ion.py => test_ocp_helm_ruby_rails_application.py} | 0 ...x_standalone.py => test_ocp_ruby_ex_standalone.py} | 0 ...treams.py => test_ocp_ruby_latest_imagestreams.py} | 0 ...i_imagestreams.py => test_ocp_s2i_imagestreams.py} | 0 ...s2i_integration.py => test_ocp_s2i_integration.py} | 0 ...l_templates.py => test_ocp_s2i_local_templates.py} | 0 ...emplates.py => test_ocp_s2i_rails_ex_templates.py} | 0 77 files changed, 32 insertions(+), 47 deletions(-) delete mode 120000 2.5/test/constants.py delete mode 120000 2.5/test/test_helm_ruby_imagestreams.py delete mode 120000 2.5/test/test_helm_ruby_rails_application.py create mode 120000 2.5/test/test_ocp_helm_ruby_imagestreams.py create mode 120000 2.5/test/test_ocp_helm_ruby_rails_application.py create mode 120000 2.5/test/test_ocp_ruby_ex_standalone.py create mode 120000 2.5/test/test_ocp_ruby_latest_imagestreams.py create mode 120000 2.5/test/test_ocp_s2i_imagestreams.py create mode 120000 2.5/test/test_ocp_s2i_integration.py create mode 120000 2.5/test/test_ocp_s2i_local_templates.py create mode 120000 2.5/test/test_ocp_s2i_rails_ex_templates.py delete mode 120000 2.5/test/test_ruby_ex_standalone.py delete mode 120000 2.5/test/test_ruby_latest_imagestreams.py delete mode 120000 2.5/test/test_s2i_imagestreams.py delete mode 120000 2.5/test/test_s2i_integration.py delete mode 120000 2.5/test/test_s2i_local_templates.py delete mode 120000 2.5/test/test_s2i_rails_ex_templates.py delete mode 120000 3.0/test/constants.py delete mode 120000 3.0/test/test_helm_ruby_imagestreams.py delete mode 120000 3.0/test/test_helm_ruby_rails_application.py create mode 120000 3.0/test/test_ocp_helm_ruby_imagestreams.py create mode 120000 3.0/test/test_ocp_helm_ruby_rails_application.py create mode 120000 3.0/test/test_ocp_ruby_ex_standalone.py create mode 120000 3.0/test/test_ocp_ruby_latest_imagestreams.py create mode 120000 3.0/test/test_ocp_s2i_imagestreams.py create mode 120000 3.0/test/test_ocp_s2i_integration.py create mode 120000 3.0/test/test_ocp_s2i_local_templates.py create mode 120000 3.0/test/test_ocp_s2i_rails_ex_templates.py delete mode 120000 3.0/test/test_ruby_ex_standalone.py delete mode 120000 3.0/test/test_ruby_latest_imagestreams.py delete mode 120000 3.0/test/test_s2i_imagestreams.py delete mode 120000 3.0/test/test_s2i_integration.py delete mode 120000 3.0/test/test_s2i_local_templates.py delete mode 120000 3.0/test/test_s2i_rails_ex_templates.py delete mode 120000 3.1/test/constants.py delete mode 120000 3.1/test/test_helm_ruby_imagestreams.py delete mode 120000 3.1/test/test_helm_ruby_rails_application.py create mode 120000 3.1/test/test_ocp_helm_ruby_imagestreams.py create mode 120000 3.1/test/test_ocp_helm_ruby_rails_application.py create mode 120000 3.1/test/test_ocp_ruby_ex_standalone.py create mode 120000 3.1/test/test_ocp_ruby_latest_imagestreams.py create mode 120000 3.1/test/test_ocp_s2i_imagestreams.py create mode 120000 3.1/test/test_ocp_s2i_integration.py create mode 120000 3.1/test/test_ocp_s2i_local_templates.py create mode 120000 3.1/test/test_ocp_s2i_rails_ex_templates.py delete mode 120000 3.1/test/test_ruby_ex_standalone.py delete mode 120000 3.1/test/test_ruby_latest_imagestreams.py delete mode 120000 3.1/test/test_s2i_imagestreams.py delete mode 120000 3.1/test/test_s2i_integration.py delete mode 120000 3.1/test/test_s2i_local_templates.py delete mode 120000 3.1/test/test_s2i_rails_ex_templates.py delete mode 120000 3.3/test/constants.py delete mode 120000 3.3/test/test_helm_ruby_imagestreams.py delete mode 120000 3.3/test/test_helm_ruby_rails_application.py create mode 120000 3.3/test/test_ocp_helm_ruby_imagestreams.py create mode 120000 3.3/test/test_ocp_helm_ruby_rails_application.py create mode 120000 3.3/test/test_ocp_ruby_ex_standalone.py create mode 120000 3.3/test/test_ocp_ruby_latest_imagestreams.py create mode 120000 3.3/test/test_ocp_s2i_imagestreams.py create mode 120000 3.3/test/test_ocp_s2i_integration.py create mode 120000 3.3/test/test_ocp_s2i_local_templates.py create mode 120000 3.3/test/test_ocp_s2i_rails_ex_templates.py delete mode 120000 3.3/test/test_ruby_ex_standalone.py delete mode 120000 3.3/test/test_ruby_latest_imagestreams.py delete mode 120000 3.3/test/test_s2i_imagestreams.py delete mode 120000 3.3/test/test_s2i_integration.py delete mode 120000 3.3/test/test_s2i_local_templates.py delete mode 120000 3.3/test/test_s2i_rails_ex_templates.py delete mode 100644 test/constants.py rename test/{test_helm_ruby_imagestreams.py => test_ocp_helm_ruby_imagestreams.py} (100%) rename test/{test_helm_ruby_rails_application.py => test_ocp_helm_ruby_rails_application.py} (100%) rename test/{test_ruby_ex_standalone.py => test_ocp_ruby_ex_standalone.py} (100%) rename test/{test_ruby_latest_imagestreams.py => test_ocp_ruby_latest_imagestreams.py} (100%) rename test/{test_s2i_imagestreams.py => test_ocp_s2i_imagestreams.py} (100%) rename test/{test_s2i_integration.py => test_ocp_s2i_integration.py} (100%) rename test/{test_s2i_local_templates.py => test_ocp_s2i_local_templates.py} (100%) rename test/{test_s2i_rails_ex_templates.py => test_ocp_s2i_rails_ex_templates.py} (100%) diff --git a/2.5/test/constants.py b/2.5/test/constants.py deleted file mode 120000 index 360f725b..00000000 --- a/2.5/test/constants.py +++ /dev/null @@ -1 +0,0 @@ -../../test/constants.py \ No newline at end of file diff --git a/2.5/test/test_helm_ruby_imagestreams.py b/2.5/test/test_helm_ruby_imagestreams.py deleted file mode 120000 index c759afba..00000000 --- a/2.5/test/test_helm_ruby_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/2.5/test/test_helm_ruby_rails_application.py b/2.5/test/test_helm_ruby_rails_application.py deleted file mode 120000 index 28f86c0a..00000000 --- a/2.5/test/test_helm_ruby_rails_application.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_rails_application.py \ No newline at end of file diff --git a/2.5/test/test_ocp_helm_ruby_imagestreams.py b/2.5/test/test_ocp_helm_ruby_imagestreams.py new file mode 120000 index 00000000..998c113c --- /dev/null +++ b/2.5/test/test_ocp_helm_ruby_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/2.5/test/test_ocp_helm_ruby_rails_application.py b/2.5/test/test_ocp_helm_ruby_rails_application.py new file mode 120000 index 00000000..aa7e5df2 --- /dev/null +++ b/2.5/test/test_ocp_helm_ruby_rails_application.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_rails_application.py \ No newline at end of file diff --git a/2.5/test/test_ocp_ruby_ex_standalone.py b/2.5/test/test_ocp_ruby_ex_standalone.py new file mode 120000 index 00000000..42ee4afc --- /dev/null +++ b/2.5/test/test_ocp_ruby_ex_standalone.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_ex_standalone.py \ No newline at end of file diff --git a/2.5/test/test_ocp_ruby_latest_imagestreams.py b/2.5/test/test_ocp_ruby_latest_imagestreams.py new file mode 120000 index 00000000..247808c0 --- /dev/null +++ b/2.5/test/test_ocp_ruby_latest_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/2.5/test/test_ocp_s2i_imagestreams.py b/2.5/test/test_ocp_s2i_imagestreams.py new file mode 120000 index 00000000..3c4b5d99 --- /dev/null +++ b/2.5/test/test_ocp_s2i_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_imagestreams.py \ No newline at end of file diff --git a/2.5/test/test_ocp_s2i_integration.py b/2.5/test/test_ocp_s2i_integration.py new file mode 120000 index 00000000..01bb85c5 --- /dev/null +++ b/2.5/test/test_ocp_s2i_integration.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_integration.py \ No newline at end of file diff --git a/2.5/test/test_ocp_s2i_local_templates.py b/2.5/test/test_ocp_s2i_local_templates.py new file mode 120000 index 00000000..16ba9d8b --- /dev/null +++ b/2.5/test/test_ocp_s2i_local_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_local_templates.py \ No newline at end of file diff --git a/2.5/test/test_ocp_s2i_rails_ex_templates.py b/2.5/test/test_ocp_s2i_rails_ex_templates.py new file mode 120000 index 00000000..b5ce0d4d --- /dev/null +++ b/2.5/test/test_ocp_s2i_rails_ex_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/2.5/test/test_ruby_ex_standalone.py b/2.5/test/test_ruby_ex_standalone.py deleted file mode 120000 index cfca1c8a..00000000 --- a/2.5/test/test_ruby_ex_standalone.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_ex_standalone.py \ No newline at end of file diff --git a/2.5/test/test_ruby_latest_imagestreams.py b/2.5/test/test_ruby_latest_imagestreams.py deleted file mode 120000 index f32f843f..00000000 --- a/2.5/test/test_ruby_latest_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/2.5/test/test_s2i_imagestreams.py b/2.5/test/test_s2i_imagestreams.py deleted file mode 120000 index 00c872cb..00000000 --- a/2.5/test/test_s2i_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_imagestreams.py \ No newline at end of file diff --git a/2.5/test/test_s2i_integration.py b/2.5/test/test_s2i_integration.py deleted file mode 120000 index c7827e84..00000000 --- a/2.5/test/test_s2i_integration.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_integration.py \ No newline at end of file diff --git a/2.5/test/test_s2i_local_templates.py b/2.5/test/test_s2i_local_templates.py deleted file mode 120000 index c844e41f..00000000 --- a/2.5/test/test_s2i_local_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_local_templates.py \ No newline at end of file diff --git a/2.5/test/test_s2i_rails_ex_templates.py b/2.5/test/test_s2i_rails_ex_templates.py deleted file mode 120000 index 9df6ffd1..00000000 --- a/2.5/test/test_s2i_rails_ex_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/3.0/test/constants.py b/3.0/test/constants.py deleted file mode 120000 index 360f725b..00000000 --- a/3.0/test/constants.py +++ /dev/null @@ -1 +0,0 @@ -../../test/constants.py \ No newline at end of file diff --git a/3.0/test/test_helm_ruby_imagestreams.py b/3.0/test/test_helm_ruby_imagestreams.py deleted file mode 120000 index c759afba..00000000 --- a/3.0/test/test_helm_ruby_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/3.0/test/test_helm_ruby_rails_application.py b/3.0/test/test_helm_ruby_rails_application.py deleted file mode 120000 index 28f86c0a..00000000 --- a/3.0/test/test_helm_ruby_rails_application.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_rails_application.py \ No newline at end of file diff --git a/3.0/test/test_ocp_helm_ruby_imagestreams.py b/3.0/test/test_ocp_helm_ruby_imagestreams.py new file mode 120000 index 00000000..998c113c --- /dev/null +++ b/3.0/test/test_ocp_helm_ruby_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/3.0/test/test_ocp_helm_ruby_rails_application.py b/3.0/test/test_ocp_helm_ruby_rails_application.py new file mode 120000 index 00000000..aa7e5df2 --- /dev/null +++ b/3.0/test/test_ocp_helm_ruby_rails_application.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_rails_application.py \ No newline at end of file diff --git a/3.0/test/test_ocp_ruby_ex_standalone.py b/3.0/test/test_ocp_ruby_ex_standalone.py new file mode 120000 index 00000000..42ee4afc --- /dev/null +++ b/3.0/test/test_ocp_ruby_ex_standalone.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_ex_standalone.py \ No newline at end of file diff --git a/3.0/test/test_ocp_ruby_latest_imagestreams.py b/3.0/test/test_ocp_ruby_latest_imagestreams.py new file mode 120000 index 00000000..247808c0 --- /dev/null +++ b/3.0/test/test_ocp_ruby_latest_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/3.0/test/test_ocp_s2i_imagestreams.py b/3.0/test/test_ocp_s2i_imagestreams.py new file mode 120000 index 00000000..3c4b5d99 --- /dev/null +++ b/3.0/test/test_ocp_s2i_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_imagestreams.py \ No newline at end of file diff --git a/3.0/test/test_ocp_s2i_integration.py b/3.0/test/test_ocp_s2i_integration.py new file mode 120000 index 00000000..01bb85c5 --- /dev/null +++ b/3.0/test/test_ocp_s2i_integration.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_integration.py \ No newline at end of file diff --git a/3.0/test/test_ocp_s2i_local_templates.py b/3.0/test/test_ocp_s2i_local_templates.py new file mode 120000 index 00000000..16ba9d8b --- /dev/null +++ b/3.0/test/test_ocp_s2i_local_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_local_templates.py \ No newline at end of file diff --git a/3.0/test/test_ocp_s2i_rails_ex_templates.py b/3.0/test/test_ocp_s2i_rails_ex_templates.py new file mode 120000 index 00000000..b5ce0d4d --- /dev/null +++ b/3.0/test/test_ocp_s2i_rails_ex_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/3.0/test/test_ruby_ex_standalone.py b/3.0/test/test_ruby_ex_standalone.py deleted file mode 120000 index cfca1c8a..00000000 --- a/3.0/test/test_ruby_ex_standalone.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_ex_standalone.py \ No newline at end of file diff --git a/3.0/test/test_ruby_latest_imagestreams.py b/3.0/test/test_ruby_latest_imagestreams.py deleted file mode 120000 index f32f843f..00000000 --- a/3.0/test/test_ruby_latest_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/3.0/test/test_s2i_imagestreams.py b/3.0/test/test_s2i_imagestreams.py deleted file mode 120000 index 00c872cb..00000000 --- a/3.0/test/test_s2i_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_imagestreams.py \ No newline at end of file diff --git a/3.0/test/test_s2i_integration.py b/3.0/test/test_s2i_integration.py deleted file mode 120000 index c7827e84..00000000 --- a/3.0/test/test_s2i_integration.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_integration.py \ No newline at end of file diff --git a/3.0/test/test_s2i_local_templates.py b/3.0/test/test_s2i_local_templates.py deleted file mode 120000 index c844e41f..00000000 --- a/3.0/test/test_s2i_local_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_local_templates.py \ No newline at end of file diff --git a/3.0/test/test_s2i_rails_ex_templates.py b/3.0/test/test_s2i_rails_ex_templates.py deleted file mode 120000 index 9df6ffd1..00000000 --- a/3.0/test/test_s2i_rails_ex_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/3.1/test/constants.py b/3.1/test/constants.py deleted file mode 120000 index 360f725b..00000000 --- a/3.1/test/constants.py +++ /dev/null @@ -1 +0,0 @@ -../../test/constants.py \ No newline at end of file diff --git a/3.1/test/test_helm_ruby_imagestreams.py b/3.1/test/test_helm_ruby_imagestreams.py deleted file mode 120000 index c759afba..00000000 --- a/3.1/test/test_helm_ruby_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/3.1/test/test_helm_ruby_rails_application.py b/3.1/test/test_helm_ruby_rails_application.py deleted file mode 120000 index 28f86c0a..00000000 --- a/3.1/test/test_helm_ruby_rails_application.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_rails_application.py \ No newline at end of file diff --git a/3.1/test/test_ocp_helm_ruby_imagestreams.py b/3.1/test/test_ocp_helm_ruby_imagestreams.py new file mode 120000 index 00000000..998c113c --- /dev/null +++ b/3.1/test/test_ocp_helm_ruby_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/3.1/test/test_ocp_helm_ruby_rails_application.py b/3.1/test/test_ocp_helm_ruby_rails_application.py new file mode 120000 index 00000000..aa7e5df2 --- /dev/null +++ b/3.1/test/test_ocp_helm_ruby_rails_application.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_rails_application.py \ No newline at end of file diff --git a/3.1/test/test_ocp_ruby_ex_standalone.py b/3.1/test/test_ocp_ruby_ex_standalone.py new file mode 120000 index 00000000..42ee4afc --- /dev/null +++ b/3.1/test/test_ocp_ruby_ex_standalone.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_ex_standalone.py \ No newline at end of file diff --git a/3.1/test/test_ocp_ruby_latest_imagestreams.py b/3.1/test/test_ocp_ruby_latest_imagestreams.py new file mode 120000 index 00000000..247808c0 --- /dev/null +++ b/3.1/test/test_ocp_ruby_latest_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/3.1/test/test_ocp_s2i_imagestreams.py b/3.1/test/test_ocp_s2i_imagestreams.py new file mode 120000 index 00000000..3c4b5d99 --- /dev/null +++ b/3.1/test/test_ocp_s2i_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_imagestreams.py \ No newline at end of file diff --git a/3.1/test/test_ocp_s2i_integration.py b/3.1/test/test_ocp_s2i_integration.py new file mode 120000 index 00000000..01bb85c5 --- /dev/null +++ b/3.1/test/test_ocp_s2i_integration.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_integration.py \ No newline at end of file diff --git a/3.1/test/test_ocp_s2i_local_templates.py b/3.1/test/test_ocp_s2i_local_templates.py new file mode 120000 index 00000000..16ba9d8b --- /dev/null +++ b/3.1/test/test_ocp_s2i_local_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_local_templates.py \ No newline at end of file diff --git a/3.1/test/test_ocp_s2i_rails_ex_templates.py b/3.1/test/test_ocp_s2i_rails_ex_templates.py new file mode 120000 index 00000000..b5ce0d4d --- /dev/null +++ b/3.1/test/test_ocp_s2i_rails_ex_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/3.1/test/test_ruby_ex_standalone.py b/3.1/test/test_ruby_ex_standalone.py deleted file mode 120000 index cfca1c8a..00000000 --- a/3.1/test/test_ruby_ex_standalone.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_ex_standalone.py \ No newline at end of file diff --git a/3.1/test/test_ruby_latest_imagestreams.py b/3.1/test/test_ruby_latest_imagestreams.py deleted file mode 120000 index f32f843f..00000000 --- a/3.1/test/test_ruby_latest_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/3.1/test/test_s2i_imagestreams.py b/3.1/test/test_s2i_imagestreams.py deleted file mode 120000 index 00c872cb..00000000 --- a/3.1/test/test_s2i_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_imagestreams.py \ No newline at end of file diff --git a/3.1/test/test_s2i_integration.py b/3.1/test/test_s2i_integration.py deleted file mode 120000 index c7827e84..00000000 --- a/3.1/test/test_s2i_integration.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_integration.py \ No newline at end of file diff --git a/3.1/test/test_s2i_local_templates.py b/3.1/test/test_s2i_local_templates.py deleted file mode 120000 index c844e41f..00000000 --- a/3.1/test/test_s2i_local_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_local_templates.py \ No newline at end of file diff --git a/3.1/test/test_s2i_rails_ex_templates.py b/3.1/test/test_s2i_rails_ex_templates.py deleted file mode 120000 index 9df6ffd1..00000000 --- a/3.1/test/test_s2i_rails_ex_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/3.3/test/constants.py b/3.3/test/constants.py deleted file mode 120000 index 360f725b..00000000 --- a/3.3/test/constants.py +++ /dev/null @@ -1 +0,0 @@ -../../test/constants.py \ No newline at end of file diff --git a/3.3/test/test_helm_ruby_imagestreams.py b/3.3/test/test_helm_ruby_imagestreams.py deleted file mode 120000 index c759afba..00000000 --- a/3.3/test/test_helm_ruby_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/3.3/test/test_helm_ruby_rails_application.py b/3.3/test/test_helm_ruby_rails_application.py deleted file mode 120000 index 28f86c0a..00000000 --- a/3.3/test/test_helm_ruby_rails_application.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_helm_ruby_rails_application.py \ No newline at end of file diff --git a/3.3/test/test_ocp_helm_ruby_imagestreams.py b/3.3/test/test_ocp_helm_ruby_imagestreams.py new file mode 120000 index 00000000..998c113c --- /dev/null +++ b/3.3/test/test_ocp_helm_ruby_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_imagestreams.py \ No newline at end of file diff --git a/3.3/test/test_ocp_helm_ruby_rails_application.py b/3.3/test/test_ocp_helm_ruby_rails_application.py new file mode 120000 index 00000000..aa7e5df2 --- /dev/null +++ b/3.3/test/test_ocp_helm_ruby_rails_application.py @@ -0,0 +1 @@ +../../test/test_ocp_helm_ruby_rails_application.py \ No newline at end of file diff --git a/3.3/test/test_ocp_ruby_ex_standalone.py b/3.3/test/test_ocp_ruby_ex_standalone.py new file mode 120000 index 00000000..42ee4afc --- /dev/null +++ b/3.3/test/test_ocp_ruby_ex_standalone.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_ex_standalone.py \ No newline at end of file diff --git a/3.3/test/test_ocp_ruby_latest_imagestreams.py b/3.3/test/test_ocp_ruby_latest_imagestreams.py new file mode 120000 index 00000000..247808c0 --- /dev/null +++ b/3.3/test/test_ocp_ruby_latest_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/3.3/test/test_ocp_s2i_imagestreams.py b/3.3/test/test_ocp_s2i_imagestreams.py new file mode 120000 index 00000000..3c4b5d99 --- /dev/null +++ b/3.3/test/test_ocp_s2i_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_imagestreams.py \ No newline at end of file diff --git a/3.3/test/test_ocp_s2i_integration.py b/3.3/test/test_ocp_s2i_integration.py new file mode 120000 index 00000000..01bb85c5 --- /dev/null +++ b/3.3/test/test_ocp_s2i_integration.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_integration.py \ No newline at end of file diff --git a/3.3/test/test_ocp_s2i_local_templates.py b/3.3/test/test_ocp_s2i_local_templates.py new file mode 120000 index 00000000..16ba9d8b --- /dev/null +++ b/3.3/test/test_ocp_s2i_local_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_local_templates.py \ No newline at end of file diff --git a/3.3/test/test_ocp_s2i_rails_ex_templates.py b/3.3/test/test_ocp_s2i_rails_ex_templates.py new file mode 120000 index 00000000..b5ce0d4d --- /dev/null +++ b/3.3/test/test_ocp_s2i_rails_ex_templates.py @@ -0,0 +1 @@ +../../test/test_ocp_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/3.3/test/test_ruby_ex_standalone.py b/3.3/test/test_ruby_ex_standalone.py deleted file mode 120000 index cfca1c8a..00000000 --- a/3.3/test/test_ruby_ex_standalone.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_ex_standalone.py \ No newline at end of file diff --git a/3.3/test/test_ruby_latest_imagestreams.py b/3.3/test/test_ruby_latest_imagestreams.py deleted file mode 120000 index f32f843f..00000000 --- a/3.3/test/test_ruby_latest_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_ruby_latest_imagestreams.py \ No newline at end of file diff --git a/3.3/test/test_s2i_imagestreams.py b/3.3/test/test_s2i_imagestreams.py deleted file mode 120000 index 00c872cb..00000000 --- a/3.3/test/test_s2i_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_imagestreams.py \ No newline at end of file diff --git a/3.3/test/test_s2i_integration.py b/3.3/test/test_s2i_integration.py deleted file mode 120000 index c7827e84..00000000 --- a/3.3/test/test_s2i_integration.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_integration.py \ No newline at end of file diff --git a/3.3/test/test_s2i_local_templates.py b/3.3/test/test_s2i_local_templates.py deleted file mode 120000 index c844e41f..00000000 --- a/3.3/test/test_s2i_local_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_local_templates.py \ No newline at end of file diff --git a/3.3/test/test_s2i_rails_ex_templates.py b/3.3/test/test_s2i_rails_ex_templates.py deleted file mode 120000 index 9df6ffd1..00000000 --- a/3.3/test/test_s2i_rails_ex_templates.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_s2i_rails_ex_templates.py \ No newline at end of file diff --git a/test/constants.py b/test/constants.py deleted file mode 100644 index 784817bf..00000000 --- a/test/constants.py +++ /dev/null @@ -1,11 +0,0 @@ -TAGS = { - "rhel8": "-ubi8", - "rhel9": "-ubi9", - "rhel10": "-ubi10", -} - -PSQL_TAGS = { - "rhel8": "-el8", - "rhel9": "-el9", - "rhel10": "-el10", -} diff --git a/test/test_helm_ruby_imagestreams.py b/test/test_ocp_helm_ruby_imagestreams.py similarity index 100% rename from test/test_helm_ruby_imagestreams.py rename to test/test_ocp_helm_ruby_imagestreams.py diff --git a/test/test_helm_ruby_rails_application.py b/test/test_ocp_helm_ruby_rails_application.py similarity index 100% rename from test/test_helm_ruby_rails_application.py rename to test/test_ocp_helm_ruby_rails_application.py diff --git a/test/test_ruby_ex_standalone.py b/test/test_ocp_ruby_ex_standalone.py similarity index 100% rename from test/test_ruby_ex_standalone.py rename to test/test_ocp_ruby_ex_standalone.py diff --git a/test/test_ruby_latest_imagestreams.py b/test/test_ocp_ruby_latest_imagestreams.py similarity index 100% rename from test/test_ruby_latest_imagestreams.py rename to test/test_ocp_ruby_latest_imagestreams.py diff --git a/test/test_s2i_imagestreams.py b/test/test_ocp_s2i_imagestreams.py similarity index 100% rename from test/test_s2i_imagestreams.py rename to test/test_ocp_s2i_imagestreams.py diff --git a/test/test_s2i_integration.py b/test/test_ocp_s2i_integration.py similarity index 100% rename from test/test_s2i_integration.py rename to test/test_ocp_s2i_integration.py diff --git a/test/test_s2i_local_templates.py b/test/test_ocp_s2i_local_templates.py similarity index 100% rename from test/test_s2i_local_templates.py rename to test/test_ocp_s2i_local_templates.py diff --git a/test/test_s2i_rails_ex_templates.py b/test/test_ocp_s2i_rails_ex_templates.py similarity index 100% rename from test/test_s2i_rails_ex_templates.py rename to test/test_ocp_s2i_rails_ex_templates.py From f656ddd7f023429359e9468d74ae1fd026b812ce Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Thu, 6 Nov 2025 16:14:32 +0100 Subject: [PATCH 2/7] Add Container PyTest suite to s2i-ruby container. Migration matrix is following: For db, puma, rack applications are classes: db -> TestRubyHelloWorldContainer puma -> TestRubyPumaTestAppContainer rack -> TestRubyRackTestAppContainer test_docker_run_usage -> test_container_basics.py->TestS2IRubyContainer(test_docker_run_usage) test_application -> test_application in each class test_connection -> test_application in each class in assert test_response -> test_application in each class in assert test_scl_usage -> test_container_basics.py->TestS2IRubyContainer(test_scl_usage) test_npm_functionality -> test_container_basics.py->TestRubyNPMtestContainer test_ruby_fips_mode -> test_container_fips.py->TestRubyFipsModeContainer(test_fips_mode) test_ruby_fips_s2i_app -> test_container_fips.TestRubyFipsApplicationContainer(test_application) test_from_dockerfile -> test_container_basics.py -> TestS2IRubyContainer(test_dockerfiles) test_from_dockerfile.s2i -> test_container_basics.py -> TestS2IRubyContainer(test_dockerfiles) Signed-off-by: Petr "Stone" Hracek --- 2.5/test/conftest.py | 64 ++++++++++ 2.5/test/run-pytest | 1 + 2.5/test/test_container_application.py | 1 + 2.5/test/test_container_basics.py | 1 + 2.5/test/test_container_fips.py | 1 + 3.0/test/conftest.py | 64 ++++++++++ 3.0/test/run-pytest | 1 + 3.0/test/test_container_application.py | 1 + 3.0/test/test_container_basics.py | 1 + 3.0/test/test_container_fips.py | 1 + 3.1/test/conftest.py | 64 ++++++++++ 3.1/test/run-pytest | 1 + 3.1/test/test_container_application.py | 1 + 3.1/test/test_container_basics.py | 1 + 3.1/test/test_container_fips.py | 1 + 3.3/test/conftest.py | 1 + 3.3/test/run-pytest | 1 + 3.3/test/test_container_application.py | 1 + 3.3/test/test_container_basics.py | 1 + 3.3/test/test_container_fips.py | 1 + test/conftest.py | 64 ++++++++++ test/run-pytest | 15 +++ test/test_container_application.py | 158 +++++++++++++++++++++++++ test/test_container_basics.py | 117 ++++++++++++++++++ test/test_container_fips.py | 116 ++++++++++++++++++ 25 files changed, 679 insertions(+) create mode 100644 2.5/test/conftest.py create mode 120000 2.5/test/run-pytest create mode 120000 2.5/test/test_container_application.py create mode 120000 2.5/test/test_container_basics.py create mode 120000 2.5/test/test_container_fips.py create mode 100644 3.0/test/conftest.py create mode 120000 3.0/test/run-pytest create mode 120000 3.0/test/test_container_application.py create mode 120000 3.0/test/test_container_basics.py create mode 120000 3.0/test/test_container_fips.py create mode 100644 3.1/test/conftest.py create mode 120000 3.1/test/run-pytest create mode 120000 3.1/test/test_container_application.py create mode 120000 3.1/test/test_container_basics.py create mode 120000 3.1/test/test_container_fips.py create mode 120000 3.3/test/conftest.py create mode 120000 3.3/test/run-pytest create mode 120000 3.3/test/test_container_application.py create mode 120000 3.3/test/test_container_basics.py create mode 120000 3.3/test/test_container_fips.py create mode 100644 test/conftest.py create mode 100755 test/run-pytest create mode 100644 test/test_container_application.py create mode 100644 test/test_container_basics.py create mode 100644 test/test_container_fips.py diff --git a/2.5/test/conftest.py b/2.5/test/conftest.py new file mode 100644 index 00000000..774b1fd6 --- /dev/null +++ b/2.5/test/conftest.py @@ -0,0 +1,64 @@ +import os + +import sys + +from pathlib import Path +from collections import namedtuple +from pytest import skip + +from container_ci_suite.utils import check_variables + + +if not check_variables(): + sys.exit(1) + +TAGS = { + "rhel8": "-ubi8", + "rhel9": "-ubi9", + "rhel10": "-ubi10", +} +BRANCH_TO_TEST = "master" +Vars = namedtuple( + "Vars", + [ + "OS", + "TAG", + "VERSION", + "IMAGE_NAME", + "SHORT_VERSION", + "TEST_DIR", + "BRANCH_TO_TEST", + ], +) +OS = os.getenv("TARGET").lower() +VERSION = os.getenv("VERSION") +BRANCH_TO_TEST = "master" +if VERSION == "3.1" or VERSION == "3.3": + BRANCH_TO_TEST = "3.3" + +VARS = Vars( + OS=OS, + TAG=TAGS.get(OS), + VERSION=VERSION, + IMAGE_NAME=os.getenv("IMAGE_NAME"), + SHORT_VERSION=VERSION.replace(".", ""), + TEST_DIR=Path(__file__).parent.absolute(), + BRANCH_TO_TEST=BRANCH_TO_TEST, +) + + +def fips_enabled(): + """ + Check if FIPS is enabled on the system. + """ + if os.path.exists("/proc/sys/crypto/fips_enabled"): + return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" + return False + + +def skip_fips_tests_rhel8(): + """ + Skip FIPS tests on RHEL8. + """ + if VARS.OS == "rhel8" and fips_enabled(): + skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/2.5/test/run-pytest b/2.5/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/2.5/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/2.5/test/test_container_application.py b/2.5/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/2.5/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/2.5/test/test_container_basics.py b/2.5/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/2.5/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/2.5/test/test_container_fips.py b/2.5/test/test_container_fips.py new file mode 120000 index 00000000..b06669f3 --- /dev/null +++ b/2.5/test/test_container_fips.py @@ -0,0 +1 @@ +../../test/test_container_fips.py \ No newline at end of file diff --git a/3.0/test/conftest.py b/3.0/test/conftest.py new file mode 100644 index 00000000..774b1fd6 --- /dev/null +++ b/3.0/test/conftest.py @@ -0,0 +1,64 @@ +import os + +import sys + +from pathlib import Path +from collections import namedtuple +from pytest import skip + +from container_ci_suite.utils import check_variables + + +if not check_variables(): + sys.exit(1) + +TAGS = { + "rhel8": "-ubi8", + "rhel9": "-ubi9", + "rhel10": "-ubi10", +} +BRANCH_TO_TEST = "master" +Vars = namedtuple( + "Vars", + [ + "OS", + "TAG", + "VERSION", + "IMAGE_NAME", + "SHORT_VERSION", + "TEST_DIR", + "BRANCH_TO_TEST", + ], +) +OS = os.getenv("TARGET").lower() +VERSION = os.getenv("VERSION") +BRANCH_TO_TEST = "master" +if VERSION == "3.1" or VERSION == "3.3": + BRANCH_TO_TEST = "3.3" + +VARS = Vars( + OS=OS, + TAG=TAGS.get(OS), + VERSION=VERSION, + IMAGE_NAME=os.getenv("IMAGE_NAME"), + SHORT_VERSION=VERSION.replace(".", ""), + TEST_DIR=Path(__file__).parent.absolute(), + BRANCH_TO_TEST=BRANCH_TO_TEST, +) + + +def fips_enabled(): + """ + Check if FIPS is enabled on the system. + """ + if os.path.exists("/proc/sys/crypto/fips_enabled"): + return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" + return False + + +def skip_fips_tests_rhel8(): + """ + Skip FIPS tests on RHEL8. + """ + if VARS.OS == "rhel8" and fips_enabled(): + skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/3.0/test/run-pytest b/3.0/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/3.0/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/3.0/test/test_container_application.py b/3.0/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/3.0/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/3.0/test/test_container_basics.py b/3.0/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/3.0/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/3.0/test/test_container_fips.py b/3.0/test/test_container_fips.py new file mode 120000 index 00000000..b06669f3 --- /dev/null +++ b/3.0/test/test_container_fips.py @@ -0,0 +1 @@ +../../test/test_container_fips.py \ No newline at end of file diff --git a/3.1/test/conftest.py b/3.1/test/conftest.py new file mode 100644 index 00000000..774b1fd6 --- /dev/null +++ b/3.1/test/conftest.py @@ -0,0 +1,64 @@ +import os + +import sys + +from pathlib import Path +from collections import namedtuple +from pytest import skip + +from container_ci_suite.utils import check_variables + + +if not check_variables(): + sys.exit(1) + +TAGS = { + "rhel8": "-ubi8", + "rhel9": "-ubi9", + "rhel10": "-ubi10", +} +BRANCH_TO_TEST = "master" +Vars = namedtuple( + "Vars", + [ + "OS", + "TAG", + "VERSION", + "IMAGE_NAME", + "SHORT_VERSION", + "TEST_DIR", + "BRANCH_TO_TEST", + ], +) +OS = os.getenv("TARGET").lower() +VERSION = os.getenv("VERSION") +BRANCH_TO_TEST = "master" +if VERSION == "3.1" or VERSION == "3.3": + BRANCH_TO_TEST = "3.3" + +VARS = Vars( + OS=OS, + TAG=TAGS.get(OS), + VERSION=VERSION, + IMAGE_NAME=os.getenv("IMAGE_NAME"), + SHORT_VERSION=VERSION.replace(".", ""), + TEST_DIR=Path(__file__).parent.absolute(), + BRANCH_TO_TEST=BRANCH_TO_TEST, +) + + +def fips_enabled(): + """ + Check if FIPS is enabled on the system. + """ + if os.path.exists("/proc/sys/crypto/fips_enabled"): + return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" + return False + + +def skip_fips_tests_rhel8(): + """ + Skip FIPS tests on RHEL8. + """ + if VARS.OS == "rhel8" and fips_enabled(): + skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/3.1/test/run-pytest b/3.1/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/3.1/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/3.1/test/test_container_application.py b/3.1/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/3.1/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/3.1/test/test_container_basics.py b/3.1/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/3.1/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/3.1/test/test_container_fips.py b/3.1/test/test_container_fips.py new file mode 120000 index 00000000..b06669f3 --- /dev/null +++ b/3.1/test/test_container_fips.py @@ -0,0 +1 @@ +../../test/test_container_fips.py \ No newline at end of file diff --git a/3.3/test/conftest.py b/3.3/test/conftest.py new file mode 120000 index 00000000..3f2d7840 --- /dev/null +++ b/3.3/test/conftest.py @@ -0,0 +1 @@ +../../test/conftest.py \ No newline at end of file diff --git a/3.3/test/run-pytest b/3.3/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/3.3/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/3.3/test/test_container_application.py b/3.3/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/3.3/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/3.3/test/test_container_basics.py b/3.3/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/3.3/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/3.3/test/test_container_fips.py b/3.3/test/test_container_fips.py new file mode 120000 index 00000000..b06669f3 --- /dev/null +++ b/3.3/test/test_container_fips.py @@ -0,0 +1 @@ +../../test/test_container_fips.py \ No newline at end of file diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 00000000..774b1fd6 --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,64 @@ +import os + +import sys + +from pathlib import Path +from collections import namedtuple +from pytest import skip + +from container_ci_suite.utils import check_variables + + +if not check_variables(): + sys.exit(1) + +TAGS = { + "rhel8": "-ubi8", + "rhel9": "-ubi9", + "rhel10": "-ubi10", +} +BRANCH_TO_TEST = "master" +Vars = namedtuple( + "Vars", + [ + "OS", + "TAG", + "VERSION", + "IMAGE_NAME", + "SHORT_VERSION", + "TEST_DIR", + "BRANCH_TO_TEST", + ], +) +OS = os.getenv("TARGET").lower() +VERSION = os.getenv("VERSION") +BRANCH_TO_TEST = "master" +if VERSION == "3.1" or VERSION == "3.3": + BRANCH_TO_TEST = "3.3" + +VARS = Vars( + OS=OS, + TAG=TAGS.get(OS), + VERSION=VERSION, + IMAGE_NAME=os.getenv("IMAGE_NAME"), + SHORT_VERSION=VERSION.replace(".", ""), + TEST_DIR=Path(__file__).parent.absolute(), + BRANCH_TO_TEST=BRANCH_TO_TEST, +) + + +def fips_enabled(): + """ + Check if FIPS is enabled on the system. + """ + if os.path.exists("/proc/sys/crypto/fips_enabled"): + return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" + return False + + +def skip_fips_tests_rhel8(): + """ + Skip FIPS tests on RHEL8. + """ + if VARS.OS == "rhel8" and fips_enabled(): + skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/test/run-pytest b/test/run-pytest new file mode 100755 index 00000000..e69959ad --- /dev/null +++ b/test/run-pytest @@ -0,0 +1,15 @@ +#!/bin/bash +# +# IMAGE_NAME specifies a name of the candidate image used for testing. +# The image has to be available before this script is executed. +# SINGLE_VERSION specifies the major version of the MariaDB in format of X.Y +# OS specifies RHEL version (e.g. OS=rhel8) +# + +THISDIR=$(dirname ${BASH_SOURCE[0]}) + +PYTHON_VERSION="3.12" +if [[ ! -f "/usr/bin/python$PYTHON_VERSION" ]]; then + PYTHON_VERSION="3.13" +fi +cd "${THISDIR}" && "python${PYTHON_VERSION}" -m pytest -s -rA --showlocals -vv test_container_*.py diff --git a/test/test_container_application.py b/test/test_container_application.py new file mode 100644 index 00000000..1b933920 --- /dev/null +++ b/test/test_container_application.py @@ -0,0 +1,158 @@ +import os + +from pathlib import Path +from container_ci_suite.container_lib import ContainerTestLib +from container_ci_suite.utils import ContainerTestLibUtils +from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper + +from conftest import VARS + + +test_app = VARS.TEST_DIR / "test-app" +puma_test_app = VARS.TEST_DIR / "puma-test-app" +rack_test_app = VARS.TEST_DIR / "rack-test-app" + +test_ports = PodmanCLIWrapper.podman_inspect( + field="{{range $key, $value := .Config.ExposedPorts }}{{$key}}{{end}}", + src_image=VARS.IMAGE_NAME, +).split("/") +print(f"The exposed ports are: {test_ports}") + + +def build_s2i_app(app_path: Path) -> ContainerTestLib: + """ + Build a S2I application. + """ + container_lib = ContainerTestLib(VARS.IMAGE_NAME) + app_name = app_path.name + s2i_app = container_lib.build_as_df( + app_path=app_path, + s2i_args="--pull-policy=never", + src_image=VARS.IMAGE_NAME, + dst_image=f"{VARS.IMAGE_NAME}-{app_name}", + ) + return s2i_app + + +class TestRubyHelloWorldContainer: + """ + Test if container works under specific user + and not only with user --user 10001 + """ + + def setup_method(self): + """ + Setup the test environment. + """ + if "test-app" not in os.listdir(VARS.TEST_DIR): + ContainerTestLibUtils.run_command( + "git clone https://github.com/openshift/ruby-hello-world.git test-app" + ) + self.s2i_app = build_s2i_app(app_path=test_app) + + def teardown_method(self): + """ + Cleanup the test environment. + """ + self.s2i_app.cleanup() + + def test_application(self): + """ + Test if container works under specific user + and not only with user --user 100001 + """ + cid_file_name = self.s2i_app.app_name + assert self.s2i_app.create_container( + cid_file_name=cid_file_name, container_args="--user 100001" + ) + cip = self.s2i_app.get_cip(cid_file_name=cid_file_name) + assert cip + # ruby --version returns proper version + assert ( + f"ruby {VARS.VERSION}." + in PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name=f"{VARS.IMAGE_NAME}-{cid_file_name}", cmd="ruby --version" + ) + ) + # Response code from HTTP url is 200 + assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0]) + + +class TestRubyPumaTestAppContainer: + """ + Test if container works under specific user + and not only with user --user 10001 + """ + + def setup_method(self): + """ + Setup the test environment. + """ + self.s2i_app = build_s2i_app(app_path=puma_test_app) + + def teardown_method(self): + """ + Cleanup the test environment. + """ + self.s2i_app.cleanup() + + def test_application(self): + """ + Test if container works under specific user + and not only with user --user 10001 + """ + cid_file_name = self.s2i_app.app_name + assert self.s2i_app.create_container( + cid_file_name=cid_file_name, container_args="--user 100001" + ) + cip = self.s2i_app.get_cip(cid_file_name=cid_file_name) + assert cip + # ruby --version returns proper version + assert ( + f"ruby {VARS.VERSION}." + in PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name=f"{VARS.IMAGE_NAME}-{cid_file_name}", cmd="ruby --version" + ) + ) + # Response code from HTTP url is 200 + assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0]) + + +class TestRubyRackTestAppContainer: + """ + Test if container works under specific user + and not only with user --user 10001 + """ + + def setup_method(self): + """ + Setup the test environment. + """ + self.s2i_app = build_s2i_app(app_path=rack_test_app) + + def teardown_method(self): + """ + Cleanup the test environment. + """ + self.s2i_app.cleanup() + + def test_application(self): + """ + Test if container works under specific user + and not only with user --user 10001 + """ + cid_file_name = self.s2i_app.app_name + assert self.s2i_app.create_container( + cid_file_name=cid_file_name, container_args="--user 100001" + ) + cip = self.s2i_app.get_cip(cid_file_name=cid_file_name) + assert cip + # ruby --version returns proper version + assert ( + f"ruby {VARS.VERSION}." + in PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name=f"{VARS.IMAGE_NAME}-{cid_file_name}", cmd="ruby --version" + ) + ) + # Response code from HTTP url is 200 + assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0]) diff --git a/test/test_container_basics.py b/test/test_container_basics.py new file mode 100644 index 00000000..c84adddc --- /dev/null +++ b/test/test_container_basics.py @@ -0,0 +1,117 @@ +import os + +import pytest + +from pathlib import Path + +from container_ci_suite.container_lib import ContainerTestLib +from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper +from container_ci_suite.utils import ContainerTestLibUtils + +from conftest import VARS + + +def build_npm_app(app_path: Path) -> ContainerTestLib: + """ + Build a S2I application. + """ + container_lib = ContainerTestLib(VARS.IMAGE_NAME) + s2i_app = container_lib.build_as_df( + app_path=app_path, + s2i_args="--pull-policy=never", + src_image=VARS.IMAGE_NAME, + dst_image=f"{VARS.IMAGE_NAME}-testapp", + ) + return s2i_app + + +class TestS2IRubyContainer: + """ + Test if container works properly + """ + + def setup_method(self): + """ + Setup the test environment. + """ + self.app = ContainerTestLib() + + def teardown_method(self): + """ + Cleanup the test environment. + """ + self.app.cleanup() + + def test_run_s2i_usage(self): + """ + Test if s2i usage works + """ + assert self.app.s2i_usage() + + def test_docker_run_usage(self): + """ + Test if container is runnable + """ + assert ( + PodmanCLIWrapper.call_podman_command( + cmd=f"run --rm {VARS.IMAGE_NAME} &>/dev/null", return_output=False + ) + == 0 + ) + + def test_scl_usage(self): + """ + Test if ruby --version returns proper output + """ + assert ( + f"ruby {VARS.VERSION}." + in PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name=VARS.IMAGE_NAME, cmd="ruby --version" + ) + ) + + @pytest.mark.parametrize("dockerfile", ["Dockerfile", "Dockerfile.s2i"]) + def test_dockerfiles(self, dockerfile): + """ + Test if building nginx-container based on + examples/Dockerfile works + """ + assert self.app.build_test_container( + dockerfile=VARS.TEST_DIR / "examples/from-dockerfile" / dockerfile, + app_url=f"https://github.com/sclorg/rails-ex.git@{VARS.BRANCH_TO_TEST}", + app_dir="app-src", + ) + assert self.app.test_app_dockerfile() + cip = self.app.get_cip() + assert cip + assert self.app.test_response( + url=cip, expected_output="Welcome to your Rails application on OpenShift" + ) + + +class TestRubyNPMtestContainer: + """ + Test checks if NPM is valid and works properly + """ + + def setup_method(self): + """ + Setup the test environment. + """ + if "test-app" not in os.listdir(VARS.TEST_DIR): + ContainerTestLibUtils.run_command( + "git clone https://github.com/openshift/ruby-hello-world.git test-app" + ) + self.s2i_app = build_npm_app(VARS.TEST_DIR / "test-app") + + def teardown_method(self): + """ + Cleanup the test environment. + """ + self.s2i_app.cleanup() + + def test_npm_works(self): + """ + Test checks if NPM is valid and works properly + """ + assert self.s2i_app.npm_works(image_name=VARS.IMAGE_NAME) diff --git a/test/test_container_fips.py b/test/test_container_fips.py new file mode 100644 index 00000000..085e8dff --- /dev/null +++ b/test/test_container_fips.py @@ -0,0 +1,116 @@ +from pathlib import Path +from container_ci_suite.container_lib import ContainerTestLib +from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper + +from conftest import VARS, skip_fips_tests_rhel8, fips_enabled + +fips_test_app = VARS.TEST_DIR / "test-fips" + + +def build_fips_test_app(app_path: Path) -> ContainerTestLib: + """ + Build a FIPS test application. + """ + container_lib = ContainerTestLib(VARS.IMAGE_NAME) + app_name = app_path.name + s2i_app = container_lib.build_as_df( + app_path=app_path, + s2i_args="--pull-policy=never", + src_image=VARS.IMAGE_NAME, + dst_image=f"{VARS.IMAGE_NAME}-{app_name}", + ) + return s2i_app + + +class TestRubyFipsModeContainer: + """ + Test if container works under specific user + and not only with user --user 10001 + """ + + def setup_method(self): + """ + Setup the test environment. + """ + self.app = ContainerTestLib() + + def teardown_method(self): + """ + Cleanup the test environment. + """ + self.app.cleanup() + + def test_fips_mode(self): + """ + Test if container works under specific user + and not only with user --user 10001 + """ + print(f"Is FIPS enabled? {fips_enabled()}") + if fips_enabled(): + output = PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name={VARS.IMAGE_NAME}, + cmd="ruby -ropenssl -e 'exit OpenSSL.fips_mode'", + ) + print(f"FIPS is enabled {output}") + assert output + else: + output = PodmanCLIWrapper.podman_run_command_and_remove( + cid_file_name=f"{VARS.IMAGE_NAME}-{self.app.app_name}", + cmd="ruby -ropenssl -e 'exit !OpenSSL.fips_mode'", + ) + print(f"FIPS is disable {output}") + assert not output + + +class TestRubyFipsApplicationContainer: + """ + Test if container works under specific user + and not only with user --user 100001 + """ + + def setup_method(self): + """ + Setup the test environment. + """ + self.fips_app = build_fips_test_app(app_path=fips_test_app) + + def teardown_method(self): + """ + Cleanup the test environment. + """ + self.fips_app.cleanup() + + def test_application(self): + """ + Test if container works under specific user + and not only with user --user 100001 + """ + skip_fips_tests_rhel8() + cid_file_name = self.fips_app.app_name + assert self.fips_app.create_container( + cid_file_name=cid_file_name, container_args="--user 100001" + ) + cid = self.fips_app.get_cid(cid_file_name=cid_file_name) + assert cid + cip = self.fips_app.get_cip(cid_file_name=cid_file_name) + assert cip + assert self.fips_app.test_response( + url=f"http://{cip}", + page="/symmetric/aes-256-cbc", + debug=True, + ) + assert self.fips_app.test_response( + url=f"http://{cip}", + page="/symmetric/des-ede-cbc", + debug=True, + ) + assert self.fips_app.test_response( + url=f"http://{cip}", + page="/hash/sha256", + debug=True, + ) + assert self.fips_app.test_response( + url=f"http://{cip}", + page="/hash/md5", + debug=True, + ) From 56313c59fc9bcc2c043bd56e371e57d0f0b66a29 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Thu, 6 Nov 2025 20:55:07 +0100 Subject: [PATCH 3/7] Fix OpenShift 4 PyTest and add missing docstring. Do not run FIPS tests on RHEL8 Signed-off-by: Petr "Stone" Hracek --- test/conftest.py | 18 ++++- test/test_container_fips.py | 1 + test/test_ocp_helm_ruby_imagestreams.py | 41 +++++------ test/test_ocp_helm_ruby_rails_application.py | 63 ++++++++-------- test/test_ocp_ruby_ex_standalone.py | 46 ++++++------ test/test_ocp_ruby_latest_imagestreams.py | 28 ++++---- test/test_ocp_s2i_imagestreams.py | 45 ++++++------ test/test_ocp_s2i_integration.py | 42 ++++++----- test/test_ocp_s2i_local_templates.py | 76 +++++++++----------- test/test_ocp_s2i_rails_ex_templates.py | 71 ++++++++---------- 10 files changed, 208 insertions(+), 223 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 774b1fd6..e4c32b5c 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -8,7 +8,11 @@ from container_ci_suite.utils import check_variables - +PSQL_TAGS = { + "rhel8": "-el8", + "rhel9": "-el9", + "rhel10": "-el10", +} if not check_variables(): sys.exit(1) @@ -17,7 +21,6 @@ "rhel9": "-ubi9", "rhel10": "-ubi10", } -BRANCH_TO_TEST = "master" Vars = namedtuple( "Vars", [ @@ -28,10 +31,16 @@ "SHORT_VERSION", "TEST_DIR", "BRANCH_TO_TEST", + "PSQL_TAG", + "PSQL_IMAGE_SHORT", + "PSQL_IMAGE_TAG", ], ) OS = os.getenv("TARGET").lower() VERSION = os.getenv("VERSION") +PSQL_TAG = PSQL_TAGS.get(OS) +PSQL_IMAGE_SHORT = f"postgresql:12{PSQL_TAG}" +PSQL_IMAGE_TAG = f"12{PSQL_TAG}" BRANCH_TO_TEST = "master" if VERSION == "3.1" or VERSION == "3.3": BRANCH_TO_TEST = "3.3" @@ -44,6 +53,9 @@ SHORT_VERSION=VERSION.replace(".", ""), TEST_DIR=Path(__file__).parent.absolute(), BRANCH_TO_TEST=BRANCH_TO_TEST, + PSQL_TAG=PSQL_TAGS.get(OS), + PSQL_IMAGE_SHORT=PSQL_IMAGE_SHORT, + PSQL_IMAGE_TAG=PSQL_IMAGE_TAG, ) @@ -60,5 +72,5 @@ def skip_fips_tests_rhel8(): """ Skip FIPS tests on RHEL8. """ - if VARS.OS == "rhel8" and fips_enabled(): + if VARS.OS == "rhel8": skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/test/test_container_fips.py b/test/test_container_fips.py index 085e8dff..25ad514a 100644 --- a/test/test_container_fips.py +++ b/test/test_container_fips.py @@ -45,6 +45,7 @@ def test_fips_mode(self): Test if container works under specific user and not only with user --user 10001 """ + skip_fips_tests_rhel8() print(f"Is FIPS enabled? {fips_enabled()}") if fips_enabled(): output = PodmanCLIWrapper.podman_run_command_and_remove( diff --git a/test/test_ocp_helm_ruby_imagestreams.py b/test/test_ocp_helm_ruby_imagestreams.py index c20f2992..f3217ac4 100644 --- a/test/test_ocp_helm_ruby_imagestreams.py +++ b/test/test_ocp_helm_ruby_imagestreams.py @@ -1,35 +1,24 @@ -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__))) - -VERSION = os.getenv("VERSION") -IMAGE_NAME = os.getenv("IMAGE_NAME") -OS = os.getenv("TARGET") +from conftest import VARS class TestHelmRHELRubyImageStreams: - def setup_method(self): package_name = "redhat-ruby-imagestreams" - path = test_dir - self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True) + + self.hc_api = HelmChartsAPI( + path=VARS.TEST_DIR, + package_name=package_name, + tarball_dir=VARS.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" + repo_url="https://github.com/sclorg/helm-charts", + repo_name="helm-charts", + subdir="charts/redhat", ) def teardown_method(self): @@ -49,6 +38,12 @@ def teardown_method(self): ], ) def test_package_imagestream(self, version, registry, expected): + """ + Test checks if Helm imagestreams are present + """ assert self.hc_api.helm_package() assert self.hc_api.helm_installation() - assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected + assert ( + self.hc_api.check_imagestreams(version=version, registry=registry) + == expected + ) diff --git a/test/test_ocp_helm_ruby_rails_application.py b/test/test_ocp_helm_ruby_rails_application.py index 2854ef76..3531c3fc 100644 --- a/test/test_ocp_helm_ruby_rails_application.py +++ b/test/test_ocp_helm_ruby_rails_application.py @@ -1,49 +1,42 @@ -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 - -from constants import TAGS - -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__))) - - -VERSION = os.getenv("VERSION") -IMAGE_NAME = os.getenv("IMAGE_NAME") -OS = os.getenv("TARGET") - - -TAG = TAGS.get(OS) +from conftest import VARS class TestHelmCakePHPTemplate: + """ + Test checks if Helm imagestream and Helm ruby rails application + works properly and response is as expected. + """ def setup_method(self): + """ + Setup the test environment. + """ package_name = "redhat-ruby-rails-application" - path = test_dir - self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True) + self.hc_api = HelmChartsAPI( + path=VARS.TEST_DIR, + package_name=package_name, + tarball_dir=VARS.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" + repo_url="https://github.com/sclorg/helm-charts", + repo_name="helm-charts", + subdir="charts/redhat", ) def teardown_method(self): + """ + Teardown the test environment. + """ self.hc_api.delete_project() def test_by_helm_test(self): - rails_ex_branch = "master" - if VERSION == "3.3": - rails_ex_branch = VERSION + """ + Test checks if Helm imagestream and Helm ruby rails application + works properly and response is as expected. + """ self.hc_api.package_name = "redhat-ruby-imagestreams" assert self.hc_api.helm_package() assert self.hc_api.helm_installation() @@ -51,10 +44,12 @@ def test_by_helm_test(self): assert self.hc_api.helm_package() assert self.hc_api.helm_installation( values={ - "ruby_version": f"{VERSION}{TAG}", + "ruby_version": f"{VARS.VERSION}{VARS.TAG}", "namespace": self.hc_api.namespace, - "source_repository_ref": rails_ex_branch, + "source_repository_ref": VARS.BRANCH_TO_TEST, } ) assert self.hc_api.is_s2i_pod_running(pod_name_prefix="rails-example") - assert self.hc_api.test_helm_chart(expected_str=["Welcome to your Rails application"]) + assert self.hc_api.test_helm_chart( + expected_str=["Welcome to your Rails application"] + ) diff --git a/test/test_ocp_ruby_ex_standalone.py b/test/test_ocp_ruby_ex_standalone.py index d22bc6e1..10332840 100644 --- a/test/test_ocp_ruby_ex_standalone.py +++ b/test/test_ocp_ruby_ex_standalone.py @@ -1,42 +1,40 @@ -import os -import sys - -import pytest - -from container_ci_suite.utils import check_variables from container_ci_suite.openshift import OpenShiftAPI -if not check_variables(): - print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") - sys.exit(1) - +from conftest import VARS -VERSION = os.getenv("VERSION") -IMAGE_NAME = os.getenv("IMAGE_NAME") -OS = os.getenv("TARGET") -SHORT_VERSION = "".join(VERSION.split(".")) - -# Replacement with 'test_python_s2i_app_ex' class TestS2IRailsExTemplate: + """ + Test checks if Ruby ex standalone template works properly and response is as expected. + """ def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix=f"ruby-{SHORT_VERSION}-testing", version=VERSION) + """ + Setup the test environment. + """ + self.oc_api = OpenShiftAPI( + pod_name_prefix=f"ruby-{VARS.SHORT_VERSION}-testing", version=VARS.VERSION + ) def teardown_method(self): + """ + Teardown the test environment. + """ self.oc_api.delete_project() def test_dancer_ex_template_inside_cluster(self): - service_name = f"ruby-{SHORT_VERSION}-testing" - rails_ex_branch = "master" - if VERSION == "3.3": - rails_ex_branch = VERSION + """ + Test checks if Ruby ex standalone template works properly and response is as expected. + """ + service_name = f"ruby-{VARS.SHORT_VERSION}-testing" assert self.oc_api.deploy_s2i_app( - image_name=IMAGE_NAME, app=f"https://github.com/sclorg/rails-ex#{rails_ex_branch}", + image_name=VARS.IMAGE_NAME, + app=f"https://github.com/sclorg/rails-ex#{VARS.BRANCH_TO_TEST}", context=".", - service_name=service_name + service_name=service_name, ) assert self.oc_api.is_template_deployed(name_in_template=service_name) assert self.oc_api.check_response_inside_cluster( - name_in_template=service_name, expected_output="Welcome to your Rails application" + name_in_template=service_name, + expected_output="Welcome to your Rails application", ) diff --git a/test/test_ocp_ruby_latest_imagestreams.py b/test/test_ocp_ruby_latest_imagestreams.py index 70aa92ac..f04ac096 100644 --- a/test/test_ocp_ruby_latest_imagestreams.py +++ b/test/test_ocp_ruby_latest_imagestreams.py @@ -1,27 +1,23 @@ -import os -import sys - -from pathlib import Path - from container_ci_suite.imagestreams import ImageStreamChecker -from container_ci_suite.utils import check_variables - -TEST_DIR = Path(os.path.abspath(os.path.dirname(__file__))) - -if not check_variables(): - print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") - sys.exit(1) -VERSION = os.getenv("VERSION") +from conftest import VARS -# Replacement with 'test_latest_imagestreams' class TestLatestImagestreams: + """ + Test checks if local imagestreams are the latest one + """ def setup_method(self): - self.isc = ImageStreamChecker(working_dir=TEST_DIR.parent.parent) + """ + Setup the test environment. + """ + self.isc = ImageStreamChecker(working_dir=VARS.TEST_DIR.parent.parent) def test_latest_imagestream(self): + """ + Test checks if local imagestreams are the latest one + """ self.latest_version = self.isc.get_latest_version() - assert self.latest_version != "" + assert self.latest_version self.isc.check_imagestreams(self.latest_version) diff --git a/test/test_ocp_s2i_imagestreams.py b/test/test_ocp_s2i_imagestreams.py index d41ddbed..7030e6d5 100644 --- a/test/test_ocp_s2i_imagestreams.py +++ b/test/test_ocp_s2i_imagestreams.py @@ -1,39 +1,40 @@ -import os -import sys - -import pytest - from container_ci_suite.openshift import OpenShiftAPI -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) - -VERSION = os.getenv("VERSION") -IMAGE_NAME = os.getenv("IMAGE_NAME") -OS = os.getenv("OS") - -SHORT_VERSION = "".join(VERSION.split(".")) +from conftest import VARS class TestRubyImagestreams: + """ + Test checks if Ruby imagestreams work properly + """ def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix=f"ruby-{SHORT_VERSION}-testing", version=VERSION, shared_cluster=True) + """ + Setup the test environment. + """ + self.oc_api = OpenShiftAPI( + pod_name_prefix=f"ruby-{VARS.SHORT_VERSION}-testing", + version=VARS.VERSION, + shared_cluster=True, + ) def teardown_method(self): + """ + Teardown the test environment. + """ self.oc_api.delete_project() def ruby_deploy_imagestream(self): - service_name = f"ruby-{SHORT_VERSION}-testing" + """ + Test checks if Ruby imagestreams work properly + """ + service_name = f"ruby-{VARS.SHORT_VERSION}-testing" assert self.oc_api.deploy_imagestream_s2i( - imagestream_file=f"{VERSION}/imagestreams/ruby-rhel.json", - image_name=IMAGE_NAME, + imagestream_file=f"{VARS.VERSION}/imagestreams/ruby-rhel.json", + image_name=VARS.IMAGE_NAME, app="https://github.com/sclorg/s2i-ruby-container.git", - context=f"{VERSION}/test/puma-test-app" + context=f"{VARS.VERSION}/test/puma-test-app", + service_name=service_name, ) assert self.oc_api.is_template_deployed(name_in_template=service_name) assert self.oc_api.check_response_inside_cluster( diff --git a/test/test_ocp_s2i_integration.py b/test/test_ocp_s2i_integration.py index f28ad854..92fb5b4a 100644 --- a/test/test_ocp_s2i_integration.py +++ b/test/test_ocp_s2i_integration.py @@ -1,35 +1,39 @@ -import os -import sys - -from container_ci_suite.utils import check_variables from container_ci_suite.openshift import OpenShiftAPI -if not check_variables(): - print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") - sys.exit(1) - +from conftest import VARS -VERSION = os.getenv("VERSION") -IMAGE_NAME = os.getenv("IMAGE_NAME") -OS = os.getenv("TARGET") -SHORT_VERSION = "".join(VERSION.split(".")) - -# Replacement with 'test_python_s2i_app_ex' class TestS2IRubyTemplate: + """ + Test checks if Ruby s2i integration works properly + """ def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix=f"ruby-{SHORT_VERSION}-testing", version=VERSION, shared_cluster=True) + """ + Setup the test environment. + """ + self.oc_api = OpenShiftAPI( + pod_name_prefix=f"ruby-{VARS.SHORT_VERSION}-testing", + version=VARS.VERSION, + shared_cluster=True, + ) def teardown_method(self): + """ + Teardown the test environment. + """ self.oc_api.delete_project() def test_rails_template_inside_cluster(self): - service_name = f"ruby-{SHORT_VERSION}-testing" + """ + Test checks if Ruby s2i integration works properly + """ + service_name = f"ruby-{VARS.SHORT_VERSION}-testing" assert self.oc_api.deploy_s2i_app( - image_name=IMAGE_NAME, app=f"https://github.com/sclorg/s2i-ruby-container.git", - context=f"{VERSION}/test/puma-test-app", - service_name=service_name + image_name=VARS.IMAGE_NAME, + app="https://github.com/sclorg/s2i-ruby-container.git", + context=f"{VARS.VERSION}/test/puma-test-app", + service_name=service_name, ) assert self.oc_api.is_template_deployed(name_in_template=service_name) assert self.oc_api.check_response_inside_cluster( diff --git a/test/test_ocp_s2i_local_templates.py b/test/test_ocp_s2i_local_templates.py index ef0967c6..06d2ef5b 100644 --- a/test/test_ocp_s2i_local_templates.py +++ b/test/test_ocp_s2i_local_templates.py @@ -1,78 +1,72 @@ -import os -import sys - import pytest from container_ci_suite.openshift import OpenShiftAPI -from container_ci_suite.utils import check_variables - -from constants import TAGS, PSQL_TAGS -if not check_variables(): - print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") - sys.exit(1) +from conftest import VARS -VERSION = os.getenv("VERSION") -IMAGE_NAME = os.getenv("IMAGE_NAME") -OS = os.getenv("TARGET") - DEPLOYED_PGSQL_IMAGE = "quay.io/sclorg/postgresql-12-c8s" -TAG = TAGS.get(OS) -PSQL_TAG = PSQL_TAGS.get(OS) -IMAGE_SHORT = f"postgresql:12{PSQL_TAG}" -IMAGE_TAG = f"12{PSQL_TAG}" - -SHORT_VERSION = "".join(VERSION.split(".")) - class TestS2IRailsExTemplate: + """ + Test checks if Ruby s2i local templates work properly + """ def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix=f"ruby-{SHORT_VERSION}-testing", version=VERSION, shared_cluster=True) + """ + Setup the test environment. + """ + self.oc_api = OpenShiftAPI( + pod_name_prefix=f"ruby-{VARS.SHORT_VERSION}-testing", + version=VARS.VERSION, + shared_cluster=True, + ) def teardown_method(self): + """ + Teardown the test environment. + """ self.oc_api.delete_project() - # # https://github.com/sclorg/s2i-ruby-container/issues/588 @pytest.mark.parametrize( "template", [ "rails.json", # "rails-postgresql-persistent.json" - ] + ], ) def test_rails_template_inside_cluster(self, template): - assert self.oc_api.upload_image(DEPLOYED_PGSQL_IMAGE, IMAGE_SHORT) - service_name = f"ruby-{SHORT_VERSION}-testing" - rails_ex_branch = "master" - if VERSION == "3.3": - rails_ex_branch = VERSION + """ + Test checks if Ruby s2i local templates work properly + """ + assert self.oc_api.upload_image(DEPLOYED_PGSQL_IMAGE, VARS.PSQL_IMAGE_SHORT) + service_name = f"ruby-{VARS.SHORT_VERSION}-testing" template_url = f"examples/{template}" openshift_args = [ - f"SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", - f"SOURCE_REPOSITORY_REF={rails_ex_branch}", - f"RUBY_VERSION={VERSION}", - f"NAME={service_name}" + "SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", + f"SOURCE_REPOSITORY_REF={VARS.BRANCH_TO_TEST}", + f"RUBY_VERSION={VARS.VERSION}", + f"NAME={service_name}", ] if template != "rails.json": openshift_args = [ - f"SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", - f"SOURCE_REPOSITORY_REF={rails_ex_branch}", - f"POSTGRESQL_VERSION={IMAGE_TAG}", - f"RUBY_VERSION={VERSION}", + "SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", + f"SOURCE_REPOSITORY_REF={VARS.BRANCH_TO_TEST}", + f"POSTGRESQL_VERSION={VARS.PSQL_IMAGE_TAG}", + f"RUBY_VERSION={VARS.VERSION}", f"NAME={service_name}", - f"DATABASE_USER=testu", - f"DATABASE_PASSWORD=testp" + "DATABASE_USER=testu", + "DATABASE_PASSWORD=testp", ] assert self.oc_api.deploy_template_with_image( - image_name=IMAGE_NAME, + image_name=VARS.IMAGE_NAME, template=template_url, name_in_template="ruby", - openshift_args=openshift_args + openshift_args=openshift_args, ) assert self.oc_api.is_template_deployed(name_in_template=service_name) assert self.oc_api.check_response_inside_cluster( - name_in_template=service_name, expected_output="Welcome to your Rails application" + name_in_template=service_name, + expected_output="Welcome to your Rails application", ) diff --git a/test/test_ocp_s2i_rails_ex_templates.py b/test/test_ocp_s2i_rails_ex_templates.py index 97eb8536..6dc9f5b0 100644 --- a/test/test_ocp_s2i_rails_ex_templates.py +++ b/test/test_ocp_s2i_rails_ex_templates.py @@ -1,35 +1,20 @@ -import os -import sys - import pytest from container_ci_suite.openshift import OpenShiftAPI -from container_ci_suite.utils import check_variables - -from constants import TAGS, PSQL_TAGS -if not check_variables(): - print("At least one variable from IMAGE_NAME, OS, VERSION is missing.") - sys.exit(1) +from conftest import VARS -VERSION = os.getenv("VERSION") -IMAGE_NAME = os.getenv("IMAGE_NAME") -OS = os.getenv("TARGET") DEPLOYED_PGSQL_IMAGE = "quay.io/sclorg/postgresql-12-c8s" -TAG = TAGS.get(OS) -PSQL_TAG = PSQL_TAGS.get(OS) -IMAGE_SHORT = f"postgresql:12{PSQL_TAG}" -IMAGE_TAG = f"12{PSQL_TAG}" - -SHORT_VERSION = "".join(VERSION.split(".")) - class TestS2IRailsExTemplate: - def setup_method(self): - self.oc_api = OpenShiftAPI(pod_name_prefix=f"ruby-{SHORT_VERSION}-testing", version=VERSION, shared_cluster=True) + self.oc_api = OpenShiftAPI( + pod_name_prefix=f"ruby-{VARS.SHORT_VERSION}-testing", + version=VARS.VERSION, + shared_cluster=True, + ) def teardown_method(self): self.oc_api.delete_project() @@ -40,40 +25,44 @@ def teardown_method(self): [ "rails.json", # "rails-postgresql-persistent.json" - ] + ], ) def test_rails_template_inside_cluster(self, template): - assert self.oc_api.upload_image(DEPLOYED_PGSQL_IMAGE, IMAGE_SHORT) - service_name = f"ruby-{SHORT_VERSION}-testing" - rails_ex_branch = "master" - if VERSION == "3.3": - rails_ex_branch = VERSION + """ + Test checks if Ruby s2i Rails ex templates work properly + """ + assert self.oc_api.upload_image(DEPLOYED_PGSQL_IMAGE, VARS.PSQL_IMAGE_SHORT) + service_name = f"ruby-{VARS.SHORT_VERSION}-testing" template_url = self.oc_api.get_raw_url_for_json( - container="rails-ex", dir="openshift/templates", filename=template, branch=rails_ex_branch + container="rails-ex", + dir="openshift/templates", + filename=template, + branch=VARS.BRANCH_TO_TEST, ) openshift_args = [ - f"SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", - f"SOURCE_REPOSITORY_REF={rails_ex_branch}", - f"RUBY_VERSION={VERSION}", - f"NAME={service_name}" + "SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", + f"SOURCE_REPOSITORY_REF={VARS.BRANCH_TO_TEST}", + f"RUBY_VERSION={VARS.VERSION}", + f"NAME={service_name}", ] if template != "rails.json": openshift_args = [ - f"SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", - f"SOURCE_REPOSITORY_REF={rails_ex_branch}", - f"POSTGRESQL_VERSION={IMAGE_TAG}", - f"RUBY_VERSION={VERSION}", + "SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", + f"SOURCE_REPOSITORY_REF={VARS.BRANCH_TO_TEST}", + f"POSTGRESQL_VERSION={VARS.PSQL_IMAGE_TAG}", + f"RUBY_VERSION={VARS.VERSION}", f"NAME={service_name}", - f"DATABASE_USER=testu", - f"DATABASE_PASSWORD=testp" + "DATABASE_USER=testu", + "DATABASE_PASSWORD=testp", ] assert self.oc_api.deploy_template_with_image( - image_name=IMAGE_NAME, + image_name=VARS.IMAGE_NAME, template=template_url, name_in_template="ruby", - openshift_args=openshift_args + openshift_args=openshift_args, ) assert self.oc_api.is_template_deployed(name_in_template=service_name) assert self.oc_api.check_response_inside_cluster( - name_in_template=service_name, expected_output="Welcome to your Rails application" + name_in_template=service_name, + expected_output="Welcome to your Rails application", ) From 90889d188961d5ffa86f709689ca9dab1c39722f Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Fri, 7 Nov 2025 10:56:06 +0100 Subject: [PATCH 4/7] Fix missing symlink to conftest.py in each directory. Fix skipping RHEL8 tests for FIPS. Signed-off-by: Petr "Stone" Hracek --- 2.5/test/conftest.py | 65 +----------------------------- 3.0/test/conftest.py | 65 +----------------------------- 3.1/test/conftest.py | 65 +----------------------------- test/conftest.py | 9 ----- test/run-openshift-pytest | 2 +- test/test_container_application.py | 14 +++++-- test/test_container_fips.py | 17 +++++--- 7 files changed, 25 insertions(+), 212 deletions(-) mode change 100644 => 120000 2.5/test/conftest.py mode change 100644 => 120000 3.0/test/conftest.py mode change 100644 => 120000 3.1/test/conftest.py diff --git a/2.5/test/conftest.py b/2.5/test/conftest.py deleted file mode 100644 index 774b1fd6..00000000 --- a/2.5/test/conftest.py +++ /dev/null @@ -1,64 +0,0 @@ -import os - -import sys - -from pathlib import Path -from collections import namedtuple -from pytest import skip - -from container_ci_suite.utils import check_variables - - -if not check_variables(): - sys.exit(1) - -TAGS = { - "rhel8": "-ubi8", - "rhel9": "-ubi9", - "rhel10": "-ubi10", -} -BRANCH_TO_TEST = "master" -Vars = namedtuple( - "Vars", - [ - "OS", - "TAG", - "VERSION", - "IMAGE_NAME", - "SHORT_VERSION", - "TEST_DIR", - "BRANCH_TO_TEST", - ], -) -OS = os.getenv("TARGET").lower() -VERSION = os.getenv("VERSION") -BRANCH_TO_TEST = "master" -if VERSION == "3.1" or VERSION == "3.3": - BRANCH_TO_TEST = "3.3" - -VARS = Vars( - OS=OS, - TAG=TAGS.get(OS), - VERSION=VERSION, - IMAGE_NAME=os.getenv("IMAGE_NAME"), - SHORT_VERSION=VERSION.replace(".", ""), - TEST_DIR=Path(__file__).parent.absolute(), - BRANCH_TO_TEST=BRANCH_TO_TEST, -) - - -def fips_enabled(): - """ - Check if FIPS is enabled on the system. - """ - if os.path.exists("/proc/sys/crypto/fips_enabled"): - return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" - return False - - -def skip_fips_tests_rhel8(): - """ - Skip FIPS tests on RHEL8. - """ - if VARS.OS == "rhel8" and fips_enabled(): - skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/2.5/test/conftest.py b/2.5/test/conftest.py new file mode 120000 index 00000000..3f2d7840 --- /dev/null +++ b/2.5/test/conftest.py @@ -0,0 +1 @@ +../../test/conftest.py \ No newline at end of file diff --git a/3.0/test/conftest.py b/3.0/test/conftest.py deleted file mode 100644 index 774b1fd6..00000000 --- a/3.0/test/conftest.py +++ /dev/null @@ -1,64 +0,0 @@ -import os - -import sys - -from pathlib import Path -from collections import namedtuple -from pytest import skip - -from container_ci_suite.utils import check_variables - - -if not check_variables(): - sys.exit(1) - -TAGS = { - "rhel8": "-ubi8", - "rhel9": "-ubi9", - "rhel10": "-ubi10", -} -BRANCH_TO_TEST = "master" -Vars = namedtuple( - "Vars", - [ - "OS", - "TAG", - "VERSION", - "IMAGE_NAME", - "SHORT_VERSION", - "TEST_DIR", - "BRANCH_TO_TEST", - ], -) -OS = os.getenv("TARGET").lower() -VERSION = os.getenv("VERSION") -BRANCH_TO_TEST = "master" -if VERSION == "3.1" or VERSION == "3.3": - BRANCH_TO_TEST = "3.3" - -VARS = Vars( - OS=OS, - TAG=TAGS.get(OS), - VERSION=VERSION, - IMAGE_NAME=os.getenv("IMAGE_NAME"), - SHORT_VERSION=VERSION.replace(".", ""), - TEST_DIR=Path(__file__).parent.absolute(), - BRANCH_TO_TEST=BRANCH_TO_TEST, -) - - -def fips_enabled(): - """ - Check if FIPS is enabled on the system. - """ - if os.path.exists("/proc/sys/crypto/fips_enabled"): - return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" - return False - - -def skip_fips_tests_rhel8(): - """ - Skip FIPS tests on RHEL8. - """ - if VARS.OS == "rhel8" and fips_enabled(): - skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/3.0/test/conftest.py b/3.0/test/conftest.py new file mode 120000 index 00000000..3f2d7840 --- /dev/null +++ b/3.0/test/conftest.py @@ -0,0 +1 @@ +../../test/conftest.py \ No newline at end of file diff --git a/3.1/test/conftest.py b/3.1/test/conftest.py deleted file mode 100644 index 774b1fd6..00000000 --- a/3.1/test/conftest.py +++ /dev/null @@ -1,64 +0,0 @@ -import os - -import sys - -from pathlib import Path -from collections import namedtuple -from pytest import skip - -from container_ci_suite.utils import check_variables - - -if not check_variables(): - sys.exit(1) - -TAGS = { - "rhel8": "-ubi8", - "rhel9": "-ubi9", - "rhel10": "-ubi10", -} -BRANCH_TO_TEST = "master" -Vars = namedtuple( - "Vars", - [ - "OS", - "TAG", - "VERSION", - "IMAGE_NAME", - "SHORT_VERSION", - "TEST_DIR", - "BRANCH_TO_TEST", - ], -) -OS = os.getenv("TARGET").lower() -VERSION = os.getenv("VERSION") -BRANCH_TO_TEST = "master" -if VERSION == "3.1" or VERSION == "3.3": - BRANCH_TO_TEST = "3.3" - -VARS = Vars( - OS=OS, - TAG=TAGS.get(OS), - VERSION=VERSION, - IMAGE_NAME=os.getenv("IMAGE_NAME"), - SHORT_VERSION=VERSION.replace(".", ""), - TEST_DIR=Path(__file__).parent.absolute(), - BRANCH_TO_TEST=BRANCH_TO_TEST, -) - - -def fips_enabled(): - """ - Check if FIPS is enabled on the system. - """ - if os.path.exists("/proc/sys/crypto/fips_enabled"): - return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" - return False - - -def skip_fips_tests_rhel8(): - """ - Skip FIPS tests on RHEL8. - """ - if VARS.OS == "rhel8" and fips_enabled(): - skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/3.1/test/conftest.py b/3.1/test/conftest.py new file mode 120000 index 00000000..3f2d7840 --- /dev/null +++ b/3.1/test/conftest.py @@ -0,0 +1 @@ +../../test/conftest.py \ No newline at end of file diff --git a/test/conftest.py b/test/conftest.py index e4c32b5c..4448c5d7 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -4,7 +4,6 @@ from pathlib import Path from collections import namedtuple -from pytest import skip from container_ci_suite.utils import check_variables @@ -66,11 +65,3 @@ def fips_enabled(): if os.path.exists("/proc/sys/crypto/fips_enabled"): return Path("/proc/sys/crypto/fips_enabled").read_text() == "1" return False - - -def skip_fips_tests_rhel8(): - """ - Skip FIPS tests on RHEL8. - """ - if VARS.OS == "rhel8": - skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.") diff --git a/test/run-openshift-pytest b/test/run-openshift-pytest index dd20bdc6..0624e422 100755 --- a/test/run-openshift-pytest +++ b/test/run-openshift-pytest @@ -8,4 +8,4 @@ THISDIR=$(dirname ${BASH_SOURCE[0]}) -cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_*.py +cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_ocp_*.py diff --git a/test/test_container_application.py b/test/test_container_application.py index 1b933920..50148f68 100644 --- a/test/test_container_application.py +++ b/test/test_container_application.py @@ -15,7 +15,7 @@ test_ports = PodmanCLIWrapper.podman_inspect( field="{{range $key, $value := .Config.ExposedPorts }}{{$key}}{{end}}", src_image=VARS.IMAGE_NAME, -).split("/") +) print(f"The exposed ports are: {test_ports}") @@ -75,7 +75,9 @@ def test_application(self): ) ) # Response code from HTTP url is 200 - assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0]) + assert self.s2i_app.test_response( + url=f"http://{cip}", port=test_ports.split("/")[0] + ) class TestRubyPumaTestAppContainer: @@ -115,7 +117,9 @@ def test_application(self): ) ) # Response code from HTTP url is 200 - assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0]) + assert self.s2i_app.test_response( + url=f"http://{cip}", port=test_ports.split("/")[0] + ) class TestRubyRackTestAppContainer: @@ -155,4 +159,6 @@ def test_application(self): ) ) # Response code from HTTP url is 200 - assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0]) + assert self.s2i_app.test_response( + url=f"http://{cip}", port=test_ports.split("/")[0] + ) diff --git a/test/test_container_fips.py b/test/test_container_fips.py index 25ad514a..7f247161 100644 --- a/test/test_container_fips.py +++ b/test/test_container_fips.py @@ -1,8 +1,11 @@ +import pytest + from pathlib import Path + from container_ci_suite.container_lib import ContainerTestLib from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper -from conftest import VARS, skip_fips_tests_rhel8, fips_enabled +from conftest import VARS, fips_enabled fips_test_app = VARS.TEST_DIR / "test-fips" @@ -25,7 +28,7 @@ def build_fips_test_app(app_path: Path) -> ContainerTestLib: class TestRubyFipsModeContainer: """ Test if container works under specific user - and not only with user --user 10001 + and not only with user --user 100001 """ def setup_method(self): @@ -45,8 +48,8 @@ def test_fips_mode(self): Test if container works under specific user and not only with user --user 10001 """ - skip_fips_tests_rhel8() - print(f"Is FIPS enabled? {fips_enabled()}") + if VARS.OS == "rhel8": + pytest.skip("Do not execute on RHEL8") if fips_enabled(): output = PodmanCLIWrapper.podman_run_command_and_remove( cid_file_name={VARS.IMAGE_NAME}, @@ -79,14 +82,16 @@ def teardown_method(self): """ Cleanup the test environment. """ - self.fips_app.cleanup() + if self.fips_app: + self.fips_app.cleanup() def test_application(self): """ Test if container works under specific user and not only with user --user 100001 """ - skip_fips_tests_rhel8() + if VARS.OS == "rhel8": + pytest.skip("Do not execute on RHEL8") cid_file_name = self.fips_app.app_name assert self.fips_app.create_container( cid_file_name=cid_file_name, container_args="--user 100001" From 7924bd76549cdd1e2f7a5a155dd5363e5969d163 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 18 Nov 2025 16:31:22 +0100 Subject: [PATCH 5/7] Refactoring tests suite to class. Build app once and test it. Signed-off-by: Petr "Stone" Hracek --- test/conftest.py | 13 ++- test/test_container_application.py | 152 +++++------------------------ 2 files changed, 36 insertions(+), 129 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 4448c5d7..a3dd4210 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -20,6 +20,15 @@ "rhel9": "-ubi9", "rhel10": "-ubi10", } +TEST_DIR = Path(__file__).parent.absolute() +APPS = [ + TEST_DIR / f"{x}test-app" + for x in [ + "", + "puma-", + "rack-", + ] +] Vars = namedtuple( "Vars", [ @@ -29,6 +38,7 @@ "IMAGE_NAME", "SHORT_VERSION", "TEST_DIR", + "APPS", "BRANCH_TO_TEST", "PSQL_TAG", "PSQL_IMAGE_SHORT", @@ -50,7 +60,8 @@ VERSION=VERSION, IMAGE_NAME=os.getenv("IMAGE_NAME"), SHORT_VERSION=VERSION.replace(".", ""), - TEST_DIR=Path(__file__).parent.absolute(), + TEST_DIR=TEST_DIR, + APPS=APPS, BRANCH_TO_TEST=BRANCH_TO_TEST, PSQL_TAG=PSQL_TAGS.get(OS), PSQL_IMAGE_SHORT=PSQL_IMAGE_SHORT, diff --git a/test/test_container_application.py b/test/test_container_application.py index 50148f68..1034fa36 100644 --- a/test/test_container_application.py +++ b/test/test_container_application.py @@ -1,6 +1,6 @@ import os +import pytest -from pathlib import Path from container_ci_suite.container_lib import ContainerTestLib from container_ci_suite.utils import ContainerTestLibUtils from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper @@ -8,148 +8,44 @@ from conftest import VARS -test_app = VARS.TEST_DIR / "test-app" -puma_test_app = VARS.TEST_DIR / "puma-test-app" -rack_test_app = VARS.TEST_DIR / "rack-test-app" - test_ports = PodmanCLIWrapper.podman_inspect( field="{{range $key, $value := .Config.ExposedPorts }}{{$key}}{{end}}", src_image=VARS.IMAGE_NAME, ) print(f"The exposed ports are: {test_ports}") - -def build_s2i_app(app_path: Path) -> ContainerTestLib: - """ - Build a S2I application. - """ - container_lib = ContainerTestLib(VARS.IMAGE_NAME) - app_name = app_path.name - s2i_app = container_lib.build_as_df( - app_path=app_path, - s2i_args="--pull-policy=never", - src_image=VARS.IMAGE_NAME, - dst_image=f"{VARS.IMAGE_NAME}-{app_name}", +if "test-app" not in os.listdir(VARS.TEST_DIR): + ContainerTestLibUtils.run_command( + "git clone https://github.com/openshift/ruby-hello-world.git test-app" ) - return s2i_app - - -class TestRubyHelloWorldContainer: - """ - Test if container works under specific user - and not only with user --user 10001 - """ - - def setup_method(self): - """ - Setup the test environment. - """ - if "test-app" not in os.listdir(VARS.TEST_DIR): - ContainerTestLibUtils.run_command( - "git clone https://github.com/openshift/ruby-hello-world.git test-app" - ) - self.s2i_app = build_s2i_app(app_path=test_app) - def teardown_method(self): - """ - Cleanup the test environment. - """ - self.s2i_app.cleanup() - def test_application(self): - """ - Test if container works under specific user - and not only with user --user 100001 - """ - cid_file_name = self.s2i_app.app_name - assert self.s2i_app.create_container( - cid_file_name=cid_file_name, container_args="--user 100001" - ) - cip = self.s2i_app.get_cip(cid_file_name=cid_file_name) - assert cip - # ruby --version returns proper version - assert ( - f"ruby {VARS.VERSION}." - in PodmanCLIWrapper.podman_run_command_and_remove( - cid_file_name=f"{VARS.IMAGE_NAME}-{cid_file_name}", cmd="ruby --version" - ) - ) - # Response code from HTTP url is 200 - assert self.s2i_app.test_response( - url=f"http://{cip}", port=test_ports.split("/")[0] - ) - - -class TestRubyPumaTestAppContainer: - """ - Test if container works under specific user - and not only with user --user 10001 - """ - - def setup_method(self): - """ - Setup the test environment. - """ - self.s2i_app = build_s2i_app(app_path=puma_test_app) - - def teardown_method(self): - """ - Cleanup the test environment. - """ - self.s2i_app.cleanup() - - def test_application(self): - """ - Test if container works under specific user - and not only with user --user 10001 - """ - cid_file_name = self.s2i_app.app_name - assert self.s2i_app.create_container( - cid_file_name=cid_file_name, container_args="--user 100001" - ) - cip = self.s2i_app.get_cip(cid_file_name=cid_file_name) - assert cip - # ruby --version returns proper version - assert ( - f"ruby {VARS.VERSION}." - in PodmanCLIWrapper.podman_run_command_and_remove( - cid_file_name=f"{VARS.IMAGE_NAME}-{cid_file_name}", cmd="ruby --version" - ) - ) - # Response code from HTTP url is 200 - assert self.s2i_app.test_response( - url=f"http://{cip}", port=test_ports.split("/")[0] +class TestRubyApplicationContainer: + @pytest.fixture( + scope="class", params=VARS.APPS, ids=[app.name for app in VARS.APPS] + ) + def build_s2i_app(self, request): + container_lib = ContainerTestLib(VARS.IMAGE_NAME) + app_name = request.param.name + s2i_app = container_lib.build_as_df( + app_path=request.param, + s2i_args="--pull-policy=never", + src_image=VARS.IMAGE_NAME, + dst_image=f"{VARS.IMAGE_NAME}-{app_name}", ) + yield s2i_app + s2i_app.cleanup() - -class TestRubyRackTestAppContainer: - """ - Test if container works under specific user - and not only with user --user 10001 - """ - - def setup_method(self): - """ - Setup the test environment. - """ - self.s2i_app = build_s2i_app(app_path=rack_test_app) - - def teardown_method(self): - """ - Cleanup the test environment. - """ - self.s2i_app.cleanup() - - def test_application(self): + def test_application(self, build_s2i_app): """ Test if container works under specific user - and not only with user --user 10001 + and not only with user --user 100001 """ - cid_file_name = self.s2i_app.app_name - assert self.s2i_app.create_container( + cid_file_name = build_s2i_app.app_name + assert build_s2i_app.create_container( cid_file_name=cid_file_name, container_args="--user 100001" ) - cip = self.s2i_app.get_cip(cid_file_name=cid_file_name) + cip = build_s2i_app.get_cip(cid_file_name=cid_file_name) assert cip # ruby --version returns proper version assert ( @@ -159,6 +55,6 @@ def test_application(self): ) ) # Response code from HTTP url is 200 - assert self.s2i_app.test_response( + assert build_s2i_app.test_response( url=f"http://{cip}", port=test_ports.split("/")[0] ) From 5d5dc9afbb5ef331bd038a87cdebbb8deb8ef66c Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Wed, 17 Dec 2025 09:25:46 +0100 Subject: [PATCH 6/7] Get rid off MariaDB from comments and replace with Ruby Signed-off-by: Petr "Stone" Hracek --- test/run-openshift-pytest | 2 +- test/run-pytest | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/run-openshift-pytest b/test/run-openshift-pytest index 0624e422..7ee86b6f 100755 --- a/test/run-openshift-pytest +++ b/test/run-openshift-pytest @@ -2,7 +2,7 @@ # # IMAGE_NAME specifies a name of the candidate image used for testing. # The image has to be available before this script is executed. -# VERSION specifies the major version of the MariaDB in format of X.Y +# VERSION specifies the major version of the Ruby in format of X.Y # OS specifies RHEL version (e.g. OS=rhel10) # diff --git a/test/run-pytest b/test/run-pytest index e69959ad..a955471d 100755 --- a/test/run-pytest +++ b/test/run-pytest @@ -2,7 +2,7 @@ # # IMAGE_NAME specifies a name of the candidate image used for testing. # The image has to be available before this script is executed. -# SINGLE_VERSION specifies the major version of the MariaDB in format of X.Y +# SINGLE_VERSION specifies the major version of the Ruby in format of X.Y # OS specifies RHEL version (e.g. OS=rhel8) # From c8f48c24241332db106df8be1d30ac89b546f9c9 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Wed, 17 Dec 2025 10:04:59 +0100 Subject: [PATCH 7/7] Add the latest container-common-scripts Signed-off-by: Petr "Stone" Hracek --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index da336ad0..01d0fe7d 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit da336ad0e6cd1f946c098bb63107b872277a8020 +Subproject commit 01d0fe7d479060f001caebab5982e9f737010f5c