diff --git a/1.20/test/run-pytest b/1.20/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/1.20/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/1.20/test/test_container_application.py b/1.20/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/1.20/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/1.20/test/test_container_basics.py b/1.20/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/1.20/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/1.20/test/test_container_example_app.py b/1.20/test/test_container_example_app.py new file mode 120000 index 00000000..ac4bde53 --- /dev/null +++ b/1.20/test/test_container_example_app.py @@ -0,0 +1 @@ +../../test/test_container_example_app.py \ No newline at end of file diff --git a/1.20/test/test_container_log.py b/1.20/test/test_container_log.py new file mode 120000 index 00000000..7f43a30a --- /dev/null +++ b/1.20/test/test_container_log.py @@ -0,0 +1 @@ +../../test/test_container_log.py \ No newline at end of file diff --git a/1.20/test/test_nginx_imagestream_s2i.py b/1.20/test/test_nginx_imagestream_s2i.py deleted file mode 120000 index 724bb1b6..00000000 --- a/1.20/test/test_nginx_imagestream_s2i.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestream_s2i.py \ No newline at end of file diff --git a/1.20/test/test_nginx_imagestreams.py b/1.20/test/test_nginx_imagestreams.py deleted file mode 120000 index d53a5d99..00000000 --- a/1.20/test/test_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestreams.py \ No newline at end of file diff --git a/1.20/test/test_nginx_local_example.py b/1.20/test/test_nginx_local_example.py deleted file mode 120000 index 7c07f8a6..00000000 --- a/1.20/test/test_nginx_local_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_local_example.py \ No newline at end of file diff --git a/1.20/test/test_nginx_remote_example.py b/1.20/test/test_nginx_remote_example.py deleted file mode 120000 index 82e280f2..00000000 --- a/1.20/test/test_nginx_remote_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_remote_example.py \ No newline at end of file diff --git a/1.20/test/test_ocp_imagestream_s2i.py b/1.20/test/test_ocp_imagestream_s2i.py new file mode 120000 index 00000000..89eb6791 --- /dev/null +++ b/1.20/test/test_ocp_imagestream_s2i.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestream_s2i.py \ No newline at end of file diff --git a/1.20/test/test_ocp_imagestreams.py b/1.20/test/test_ocp_imagestreams.py new file mode 120000 index 00000000..ee905e77 --- /dev/null +++ b/1.20/test/test_ocp_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestreams.py \ No newline at end of file diff --git a/1.20/test/test_ocp_local_example.py b/1.20/test/test_ocp_local_example.py new file mode 120000 index 00000000..f2f3e849 --- /dev/null +++ b/1.20/test/test_ocp_local_example.py @@ -0,0 +1 @@ +../../test/test_ocp_local_example.py \ No newline at end of file diff --git a/1.20/test/test_ocp_remote_example.py b/1.20/test/test_ocp_remote_example.py new file mode 120000 index 00000000..7a912c02 --- /dev/null +++ b/1.20/test/test_ocp_remote_example.py @@ -0,0 +1 @@ +../../test/test_ocp_remote_example.py \ No newline at end of file diff --git a/1.20/test/test_ocp_shared_helm_imagestreams.py b/1.20/test/test_ocp_shared_helm_imagestreams.py new file mode 120000 index 00000000..76d5701d --- /dev/null +++ b/1.20/test/test_ocp_shared_helm_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_imagestreams.py \ No newline at end of file diff --git a/1.20/test/test_ocp_shared_helm_template.py b/1.20/test/test_ocp_shared_helm_template.py new file mode 120000 index 00000000..9cf469bf --- /dev/null +++ b/1.20/test/test_ocp_shared_helm_template.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_template.py \ No newline at end of file diff --git a/1.20/test/test_ocp_template_example_app.py b/1.20/test/test_ocp_template_example_app.py new file mode 120000 index 00000000..49e607f8 --- /dev/null +++ b/1.20/test/test_ocp_template_example_app.py @@ -0,0 +1 @@ +../../test/test_ocp_template_example_app.py \ No newline at end of file diff --git a/1.20/test/test_shared_helm_nginx_imagestreams.py b/1.20/test/test_shared_helm_nginx_imagestreams.py deleted file mode 120000 index 6363402b..00000000 --- a/1.20/test/test_shared_helm_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_imagestreams.py \ No newline at end of file diff --git a/1.20/test/test_shared_helm_nginx_template.py b/1.20/test/test_shared_helm_nginx_template.py deleted file mode 120000 index 01f3b3df..00000000 --- a/1.20/test/test_shared_helm_nginx_template.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_template.py \ No newline at end of file diff --git a/1.22/test/run-pytest b/1.22/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/1.22/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/1.22/test/test_container_application.py b/1.22/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/1.22/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/1.22/test/test_container_basics.py b/1.22/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/1.22/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/1.22/test/test_container_example_app.py b/1.22/test/test_container_example_app.py new file mode 120000 index 00000000..ac4bde53 --- /dev/null +++ b/1.22/test/test_container_example_app.py @@ -0,0 +1 @@ +../../test/test_container_example_app.py \ No newline at end of file diff --git a/1.22/test/test_container_log.py b/1.22/test/test_container_log.py new file mode 120000 index 00000000..7f43a30a --- /dev/null +++ b/1.22/test/test_container_log.py @@ -0,0 +1 @@ +../../test/test_container_log.py \ No newline at end of file diff --git a/1.22/test/test_nginx_imagestream_s2i.py b/1.22/test/test_nginx_imagestream_s2i.py deleted file mode 120000 index 724bb1b6..00000000 --- a/1.22/test/test_nginx_imagestream_s2i.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestream_s2i.py \ No newline at end of file diff --git a/1.22/test/test_nginx_imagestreams.py b/1.22/test/test_nginx_imagestreams.py deleted file mode 120000 index d53a5d99..00000000 --- a/1.22/test/test_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestreams.py \ No newline at end of file diff --git a/1.22/test/test_nginx_local_example.py b/1.22/test/test_nginx_local_example.py deleted file mode 120000 index 7c07f8a6..00000000 --- a/1.22/test/test_nginx_local_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_local_example.py \ No newline at end of file diff --git a/1.22/test/test_nginx_remote_example.py b/1.22/test/test_nginx_remote_example.py deleted file mode 120000 index 82e280f2..00000000 --- a/1.22/test/test_nginx_remote_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_remote_example.py \ No newline at end of file diff --git a/1.22/test/test_ocp_imagestream_s2i.py b/1.22/test/test_ocp_imagestream_s2i.py new file mode 120000 index 00000000..89eb6791 --- /dev/null +++ b/1.22/test/test_ocp_imagestream_s2i.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestream_s2i.py \ No newline at end of file diff --git a/1.22/test/test_ocp_imagestreams.py b/1.22/test/test_ocp_imagestreams.py new file mode 120000 index 00000000..ee905e77 --- /dev/null +++ b/1.22/test/test_ocp_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestreams.py \ No newline at end of file diff --git a/1.22/test/test_ocp_local_example.py b/1.22/test/test_ocp_local_example.py new file mode 120000 index 00000000..f2f3e849 --- /dev/null +++ b/1.22/test/test_ocp_local_example.py @@ -0,0 +1 @@ +../../test/test_ocp_local_example.py \ No newline at end of file diff --git a/1.22/test/test_ocp_remote_example.py b/1.22/test/test_ocp_remote_example.py new file mode 120000 index 00000000..7a912c02 --- /dev/null +++ b/1.22/test/test_ocp_remote_example.py @@ -0,0 +1 @@ +../../test/test_ocp_remote_example.py \ No newline at end of file diff --git a/1.22/test/test_ocp_shared_helm_imagestreams.py b/1.22/test/test_ocp_shared_helm_imagestreams.py new file mode 120000 index 00000000..76d5701d --- /dev/null +++ b/1.22/test/test_ocp_shared_helm_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_imagestreams.py \ No newline at end of file diff --git a/1.22/test/test_ocp_shared_helm_template.py b/1.22/test/test_ocp_shared_helm_template.py new file mode 120000 index 00000000..9cf469bf --- /dev/null +++ b/1.22/test/test_ocp_shared_helm_template.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_template.py \ No newline at end of file diff --git a/1.22/test/test_ocp_template_example_app.py b/1.22/test/test_ocp_template_example_app.py new file mode 120000 index 00000000..49e607f8 --- /dev/null +++ b/1.22/test/test_ocp_template_example_app.py @@ -0,0 +1 @@ +../../test/test_ocp_template_example_app.py \ No newline at end of file diff --git a/1.22/test/test_shared_helm_nginx_imagestreams.py b/1.22/test/test_shared_helm_nginx_imagestreams.py deleted file mode 120000 index 6363402b..00000000 --- a/1.22/test/test_shared_helm_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_imagestreams.py \ No newline at end of file diff --git a/1.22/test/test_shared_helm_nginx_template.py b/1.22/test/test_shared_helm_nginx_template.py deleted file mode 120000 index 01f3b3df..00000000 --- a/1.22/test/test_shared_helm_nginx_template.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_template.py \ No newline at end of file diff --git a/1.24/test/run-pytest b/1.24/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/1.24/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/1.24/test/test_container_application.py b/1.24/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/1.24/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/1.24/test/test_container_basics.py b/1.24/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/1.24/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/1.24/test/test_container_example_app.py b/1.24/test/test_container_example_app.py new file mode 120000 index 00000000..ac4bde53 --- /dev/null +++ b/1.24/test/test_container_example_app.py @@ -0,0 +1 @@ +../../test/test_container_example_app.py \ No newline at end of file diff --git a/1.24/test/test_container_log.py b/1.24/test/test_container_log.py new file mode 120000 index 00000000..7f43a30a --- /dev/null +++ b/1.24/test/test_container_log.py @@ -0,0 +1 @@ +../../test/test_container_log.py \ No newline at end of file diff --git a/1.24/test/test_nginx_imagestream_s2i.py b/1.24/test/test_nginx_imagestream_s2i.py deleted file mode 120000 index 724bb1b6..00000000 --- a/1.24/test/test_nginx_imagestream_s2i.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestream_s2i.py \ No newline at end of file diff --git a/1.24/test/test_nginx_imagestreams.py b/1.24/test/test_nginx_imagestreams.py deleted file mode 120000 index d53a5d99..00000000 --- a/1.24/test/test_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestreams.py \ No newline at end of file diff --git a/1.24/test/test_nginx_local_example.py b/1.24/test/test_nginx_local_example.py deleted file mode 120000 index 7c07f8a6..00000000 --- a/1.24/test/test_nginx_local_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_local_example.py \ No newline at end of file diff --git a/1.24/test/test_nginx_remote_example.py b/1.24/test/test_nginx_remote_example.py deleted file mode 120000 index 82e280f2..00000000 --- a/1.24/test/test_nginx_remote_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_remote_example.py \ No newline at end of file diff --git a/1.24/test/test_nginx_template_example_app.py b/1.24/test/test_nginx_template_example_app.py deleted file mode 120000 index efdf9caa..00000000 --- a/1.24/test/test_nginx_template_example_app.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_template_example_app.py \ No newline at end of file diff --git a/1.24/test/test_ocp_imagestream_s2i.py b/1.24/test/test_ocp_imagestream_s2i.py new file mode 120000 index 00000000..89eb6791 --- /dev/null +++ b/1.24/test/test_ocp_imagestream_s2i.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestream_s2i.py \ No newline at end of file diff --git a/1.24/test/test_ocp_imagestreams.py b/1.24/test/test_ocp_imagestreams.py new file mode 120000 index 00000000..ee905e77 --- /dev/null +++ b/1.24/test/test_ocp_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestreams.py \ No newline at end of file diff --git a/1.24/test/test_ocp_local_example.py b/1.24/test/test_ocp_local_example.py new file mode 120000 index 00000000..f2f3e849 --- /dev/null +++ b/1.24/test/test_ocp_local_example.py @@ -0,0 +1 @@ +../../test/test_ocp_local_example.py \ No newline at end of file diff --git a/1.24/test/test_ocp_remote_example.py b/1.24/test/test_ocp_remote_example.py new file mode 120000 index 00000000..7a912c02 --- /dev/null +++ b/1.24/test/test_ocp_remote_example.py @@ -0,0 +1 @@ +../../test/test_ocp_remote_example.py \ No newline at end of file diff --git a/1.24/test/test_ocp_shared_helm_imagestreams.py b/1.24/test/test_ocp_shared_helm_imagestreams.py new file mode 120000 index 00000000..76d5701d --- /dev/null +++ b/1.24/test/test_ocp_shared_helm_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_imagestreams.py \ No newline at end of file diff --git a/1.24/test/test_ocp_shared_helm_template.py b/1.24/test/test_ocp_shared_helm_template.py new file mode 120000 index 00000000..9cf469bf --- /dev/null +++ b/1.24/test/test_ocp_shared_helm_template.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_template.py \ No newline at end of file diff --git a/1.24/test/test_ocp_template_example_app.py b/1.24/test/test_ocp_template_example_app.py new file mode 120000 index 00000000..49e607f8 --- /dev/null +++ b/1.24/test/test_ocp_template_example_app.py @@ -0,0 +1 @@ +../../test/test_ocp_template_example_app.py \ No newline at end of file diff --git a/1.24/test/test_shared_helm_nginx_imagestreams.py b/1.24/test/test_shared_helm_nginx_imagestreams.py deleted file mode 120000 index 6363402b..00000000 --- a/1.24/test/test_shared_helm_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_imagestreams.py \ No newline at end of file diff --git a/1.24/test/test_shared_helm_nginx_template.py b/1.24/test/test_shared_helm_nginx_template.py deleted file mode 120000 index 01f3b3df..00000000 --- a/1.24/test/test_shared_helm_nginx_template.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_template.py \ No newline at end of file diff --git a/1.26/test/run-pytest b/1.26/test/run-pytest new file mode 120000 index 00000000..efe32b48 --- /dev/null +++ b/1.26/test/run-pytest @@ -0,0 +1 @@ +../../test/run-pytest \ No newline at end of file diff --git a/1.26/test/test_container_application.py b/1.26/test/test_container_application.py new file mode 120000 index 00000000..25c1c1ec --- /dev/null +++ b/1.26/test/test_container_application.py @@ -0,0 +1 @@ +../../test/test_container_application.py \ No newline at end of file diff --git a/1.26/test/test_container_basics.py b/1.26/test/test_container_basics.py new file mode 120000 index 00000000..b85dc139 --- /dev/null +++ b/1.26/test/test_container_basics.py @@ -0,0 +1 @@ +../../test/test_container_basics.py \ No newline at end of file diff --git a/1.26/test/test_container_example_app.py b/1.26/test/test_container_example_app.py new file mode 120000 index 00000000..ac4bde53 --- /dev/null +++ b/1.26/test/test_container_example_app.py @@ -0,0 +1 @@ +../../test/test_container_example_app.py \ No newline at end of file diff --git a/1.26/test/test_container_log.py b/1.26/test/test_container_log.py new file mode 120000 index 00000000..7f43a30a --- /dev/null +++ b/1.26/test/test_container_log.py @@ -0,0 +1 @@ +../../test/test_container_log.py \ No newline at end of file diff --git a/1.26/test/test_nginx_imagestream_s2i.py b/1.26/test/test_nginx_imagestream_s2i.py deleted file mode 120000 index 724bb1b6..00000000 --- a/1.26/test/test_nginx_imagestream_s2i.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestream_s2i.py \ No newline at end of file diff --git a/1.26/test/test_nginx_imagestreams.py b/1.26/test/test_nginx_imagestreams.py deleted file mode 120000 index d53a5d99..00000000 --- a/1.26/test/test_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_imagestreams.py \ No newline at end of file diff --git a/1.26/test/test_nginx_local_example.py b/1.26/test/test_nginx_local_example.py deleted file mode 120000 index 7c07f8a6..00000000 --- a/1.26/test/test_nginx_local_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_local_example.py \ No newline at end of file diff --git a/1.26/test/test_nginx_remote_example.py b/1.26/test/test_nginx_remote_example.py deleted file mode 120000 index 82e280f2..00000000 --- a/1.26/test/test_nginx_remote_example.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_remote_example.py \ No newline at end of file diff --git a/1.26/test/test_nginx_template_example_app.py b/1.26/test/test_nginx_template_example_app.py deleted file mode 120000 index efdf9caa..00000000 --- a/1.26/test/test_nginx_template_example_app.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_nginx_template_example_app.py \ No newline at end of file diff --git a/1.26/test/test_ocp_imagestream_s2i.py b/1.26/test/test_ocp_imagestream_s2i.py new file mode 120000 index 00000000..89eb6791 --- /dev/null +++ b/1.26/test/test_ocp_imagestream_s2i.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestream_s2i.py \ No newline at end of file diff --git a/1.26/test/test_ocp_imagestreams.py b/1.26/test/test_ocp_imagestreams.py new file mode 120000 index 00000000..ee905e77 --- /dev/null +++ b/1.26/test/test_ocp_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_imagestreams.py \ No newline at end of file diff --git a/1.26/test/test_ocp_local_example.py b/1.26/test/test_ocp_local_example.py new file mode 120000 index 00000000..f2f3e849 --- /dev/null +++ b/1.26/test/test_ocp_local_example.py @@ -0,0 +1 @@ +../../test/test_ocp_local_example.py \ No newline at end of file diff --git a/1.26/test/test_ocp_remote_example.py b/1.26/test/test_ocp_remote_example.py new file mode 120000 index 00000000..7a912c02 --- /dev/null +++ b/1.26/test/test_ocp_remote_example.py @@ -0,0 +1 @@ +../../test/test_ocp_remote_example.py \ No newline at end of file diff --git a/1.26/test/test_ocp_shared_helm_imagestreams.py b/1.26/test/test_ocp_shared_helm_imagestreams.py new file mode 120000 index 00000000..76d5701d --- /dev/null +++ b/1.26/test/test_ocp_shared_helm_imagestreams.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_imagestreams.py \ No newline at end of file diff --git a/1.26/test/test_ocp_shared_helm_template.py b/1.26/test/test_ocp_shared_helm_template.py new file mode 120000 index 00000000..9cf469bf --- /dev/null +++ b/1.26/test/test_ocp_shared_helm_template.py @@ -0,0 +1 @@ +../../test/test_ocp_shared_helm_template.py \ No newline at end of file diff --git a/1.26/test/test_ocp_template_example_app.py b/1.26/test/test_ocp_template_example_app.py new file mode 120000 index 00000000..49e607f8 --- /dev/null +++ b/1.26/test/test_ocp_template_example_app.py @@ -0,0 +1 @@ +../../test/test_ocp_template_example_app.py \ No newline at end of file diff --git a/1.26/test/test_shared_helm_nginx_imagestreams.py b/1.26/test/test_shared_helm_nginx_imagestreams.py deleted file mode 120000 index 6363402b..00000000 --- a/1.26/test/test_shared_helm_nginx_imagestreams.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_imagestreams.py \ No newline at end of file diff --git a/1.26/test/test_shared_helm_nginx_template.py b/1.26/test/test_shared_helm_nginx_template.py deleted file mode 120000 index 01f3b3df..00000000 --- a/1.26/test/test_shared_helm_nginx_template.py +++ /dev/null @@ -1 +0,0 @@ -../../test/test_shared_helm_nginx_template.py \ No newline at end of file diff --git a/test/constants.py b/test/constants.py index e0402ba6..b83f17fc 100644 --- a/test/constants.py +++ b/test/constants.py @@ -1,5 +1,12 @@ +import os + + TAGS = { "rhel8": "-ubi8", "rhel9": "-ubi9", "rhel10": "-ubi10", } + + +def return_app_name(request): + return os.path.basename(request.param) diff --git a/test/dockerfile_processor.py b/test/dockerfile_processor.py new file mode 100644 index 00000000..c31573cb --- /dev/null +++ b/test/dockerfile_processor.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 +""" +Dockerfile processor module to replace sed commands with Python functionality. +This module provides utilities to process Dockerfiles by replacing version strings +and environment variables. +""" + +import re +import os +import tempfile +from pathlib import Path +from typing import Optional, Union + + +class DockerfileProcessor: + """ + A class to process Dockerfiles by replacing version strings and environment variables. + This replaces the functionality of sed commands used in shell scripts. + """ + + def __init__(self, dockerfile_path: Union[str, Path]): + """ + Initialize the DockerfileProcessor with a path to a Dockerfile. + + Args: + dockerfile_path: Path to the Dockerfile to process + """ + self.dockerfile_path = Path(dockerfile_path) + if not self.dockerfile_path.exists(): + raise FileNotFoundError(f"Dockerfile not found: {dockerfile_path}") + + def process_nginx_version(self, version: str, output_path: Optional[Union[str, Path]] = None) -> str: + """ + Process the Dockerfile to replace NGINX version strings. + + This method performs the same operations as the sed command: + sed -e "s/^ENV NGINX_VERSION.*$/ENV NGINX_VERSION=$version/" -e "s/\$NGINX_VERSION/$version/g" + + Args: + version: The NGINX version to use for replacement + output_path: Optional path to write the processed content. If None, returns content as string. + + Returns: + The processed Dockerfile content as a string + """ + with open(self.dockerfile_path, 'r') as f: + content = f.read() + + # Replace ENV NGINX_VERSION line (equivalent to s/^ENV NGINX_VERSION.*$/ENV NGINX_VERSION=$version/) + content = re.sub(r'^ENV NGINX_VERSION.*$', f'ENV NGINX_VERSION={version}', content, flags=re.MULTILINE) + + # Replace all occurrences of $NGINX_VERSION (equivalent to s/\$NGINX_VERSION/$version/g) + content = content.replace('$NGINX_VERSION', version) + + if output_path: + output_path = Path(output_path) + with open(output_path, 'w') as f: + f.write(content) + + return content + + def create_temp_dockerfile(self, version: str) -> str: + """ + Create a temporary Dockerfile with processed version strings. + + Args: + version: The NGINX version to use for replacement + + Returns: + Path to the temporary Dockerfile + """ + # Create a temporary file + fd, temp_path = tempfile.mkstemp(suffix='.dockerfile', prefix='nginx_test_') + os.close(fd) # Close the file descriptor, we'll write to it separately + + # Process and write the content + self.process_nginx_version(version, temp_path) + + return temp_path + + def validate_dockerfile_syntax(self, content: str) -> bool: + """ + Basic validation of Dockerfile syntax. + + Args: + content: Dockerfile content to validate + + Returns: + True if basic syntax checks pass, False otherwise + """ + lines = content.strip().split('\n') + + # Check for basic Dockerfile structure + has_from = any(line.strip().upper().startswith('FROM') for line in lines) + if not has_from: + return False + + # Check for valid instruction format + valid_instructions = { + 'FROM', 'RUN', 'CMD', 'LABEL', 'EXPOSE', 'ENV', 'ADD', 'COPY', + 'ENTRYPOINT', 'VOLUME', 'USER', 'WORKDIR', 'ARG', 'ONBUILD', + 'STOPSIGNAL', 'HEALTHCHECK', 'SHELL' + } + + for line in lines: + line = line.strip() + if not line or line.startswith('#'): + continue + + # Extract the instruction (first word) + instruction = line.split()[0].upper() + if instruction not in valid_instructions: + return False + + return True + + @staticmethod + def replace_version_in_file(dockerfile_path: Union[str, Path], version: str, output_path: Union[str, Path]) -> None: + """ + Static method to replace version in a Dockerfile and write to output file. + This is the direct replacement for the sed command functionality. + + Args: + dockerfile_path: Path to input Dockerfile + version: Version string to replace + output_path: Path to output the processed Dockerfile + """ + processor = DockerfileProcessor(dockerfile_path) + processor.process_nginx_version(version, output_path) + + +def main(): + """ + Command-line interface for the Dockerfile processor. + Usage: python dockerfile_processor.py + """ + import sys + + if len(sys.argv) != 4: + print("Usage: python dockerfile_processor.py ") + sys.exit(1) + + dockerfile_path, version, output_path = sys.argv[1:4] + + try: + DockerfileProcessor.replace_version_in_file(dockerfile_path, version, output_path) + print(f"Successfully processed {dockerfile_path} -> {output_path} with version {version}") + except Exception as e: + print(f"Error: {e}") + sys.exit(1) + + +if __name__ == "__main__": + main() + diff --git a/test/pytest.ini b/test/pytest.ini new file mode 100644 index 00000000..9cf6f4be --- /dev/null +++ b/test/pytest.ini @@ -0,0 +1,26 @@ +[tool:pytest] +# Pytest configuration for nginx-container tests +testpaths = . +python_files = test_*.py +python_classes = Test* +python_functions = test_* +addopts = + -v + --tb=short + --strict-markers + --strict-config + --disable-warnings + -ra +markers = + unit: Unit tests for individual components + integration: Integration tests that test component interaction + dockerfile: Tests related to Dockerfile processing + slow: Tests that take a long time to run + network: Tests that require network access + container: Tests that require container runtime + openshift: Tests that require OpenShift environment + parametrize: Parametrized tests with multiple inputs +filterwarnings = + ignore::DeprecationWarning + ignore::PendingDeprecationWarning + diff --git a/test/run b/test/run index 9e92e043..a7896312 100755 --- a/test/run +++ b/test/run @@ -25,7 +25,6 @@ TEST_LIST_HOOK_APP="test_pre_init_script" TEST_LIST_PERL_APP="test_perl_directive" TEST_LIST_MISC=run_dockerfiles_test - source "$test_dir/test-lib.sh" # TODO: This should be part of the image metadata @@ -421,7 +420,7 @@ TEST_SET=${TEST_LIST_HOOK_APP} ct_run_tests_from_testset "start-hook-test-app" # Run the chosen tests (not for micro variant which lacks perl) if ! [[ "${IMAGE_NAME}" =~ .*micro.* ]] ; then build_image "perl-test-app" - TEST_LIST=${TEST_LIST_PERL_APP} ct_run_tests_from_testset "perl-test-app" + TEST_SET=${TEST_LIST_PERL_APP} ct_run_tests_from_testset "perl-test-app" fi diff --git a/test/run-openshift-pytest b/test/run-openshift-pytest index 8f6bd18c..ed9d8a39 100755 --- a/test/run-openshift-pytest +++ b/test/run-openshift-pytest @@ -10,4 +10,4 @@ THISDIR=$(dirname ${BASH_SOURCE[0]}) git show -s -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/run-pytest b/test/run-pytest new file mode 100755 index 00000000..abe61217 --- /dev/null +++ b/test/run-pytest @@ -0,0 +1,17 @@ +#!/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]}) + +git show -s + +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..2e8024af --- /dev/null +++ b/test/test_container_application.py @@ -0,0 +1,95 @@ +import os +import sys +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 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") +IMAGE_NAME = os.getenv("IMAGE_NAME") +OS = os.getenv("TARGET").lower() +test_app = os.path.join(TEST_DIR, "test-app") + + +@pytest.fixture(scope="module", params=[test_app]) +def app(request): + container_lib = ContainerTestLib(IMAGE_NAME) + app_name = os.path.basename(request.param) + s2i_app = container_lib.build_as_df( + app_path=request.param, + s2i_args="--pull-policy=never", + src_image=IMAGE_NAME, + dst_image=f"{IMAGE_NAME}-{app_name}" + ) + yield s2i_app + s2i_app.clean_containers() + + +class TestNginxApplicationContainer: + + # test_application + def test_application(self, app): + version = VERSION.replace("-micro", "") + cid_file_name = "test-app" + app.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file_name}") + assert app.create_container( + cid_file_name=cid_file_name, + container_args=f"--user 10001" + ) + cip = app.get_cip(cid_file_name=cid_file_name) + assert PodmanCLIWrapper.podman_run_command( + f"--rm {app.image_name} /bin/bash -c 'nginx -v'" + ).startswith(f"nginx version: nginx/{version}") + assert app.test_response( + url=f"http://{cip}", expected_output="NGINX is working" + ) + assert app.test_response( + url=f"http://{cip}", expected_output="NGINX2 is working", + host="localhost2" + ) + assert app.test_response( + url=f"http://{cip}", expected_output="NGINX2 is working", + page="/aliased/index2.html" + ) + assert app.test_response( + url=f"http://{cip}", expected_code=404, + page="/nginx-cfg/default.conf" + ) + + + # test_application_user + def test_application_user(self, app): + version = VERSION.replace("-micro", "") + cid_file_name = "test-app" + app.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file_name}") + assert app.create_container( + cid_file_name=cid_file_name, + container_args=f"--user 10001 --user 12345" + ) + cip = app.get_cip(cid_file_name=cid_file_name) + assert PodmanCLIWrapper.podman_run_command( + f"--rm {app.image_name} /bin/bash -c 'nginx -v'" + ).startswith(f"nginx version: nginx/{version}") + assert app.test_response( + url=f"http://{cip}", expected_output="NGINX is working" + ) + assert app.test_response( + url=f"http://{cip}", expected_output="NGINX2 is working", + host="localhost2" + ) + assert app.test_response( + url=f"http://{cip}", expected_output="NGINX2 is working", + page="/aliased/index2.html" + ) + assert app.test_response( + url=f"http://{cip}", expected_code=404, + page="/nginx-cfg/default.conf" + ) diff --git a/test/test_container_basics.py b/test/test_container_basics.py new file mode 100644 index 00000000..7e78cb9a --- /dev/null +++ b/test/test_container_basics.py @@ -0,0 +1,71 @@ +import os +import sys +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 check_variables +from container_ci_suite.dockerfile_processor import DockerfileProcessor + + +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") +IMAGE_NAME = os.getenv("IMAGE_NAME") +OS = os.getenv("TARGET").lower() + + +@pytest.fixture(scope="module") +def app(request): + app = ContainerTestLib(image_name=IMAGE_NAME, s2i_image=True) + yield app + app.clean_containers() + app.clean_app_images() + +class TestNginxContainer: + + # test_s2i_usage + def test_run_s2i_usage(self, app): + output = app.s2i_usage() + assert output != "" + + # # test_docker_run_usage + def test_docker_run_usage(self): + assert PodmanCLIWrapper.call_podman_command( + cmd=f"run --rm {IMAGE_NAME} &>/dev/null", + return_output=False + ) == 0 + + + def test_scl_usage(self): + version = VERSION.replace("-micro", "") + assert PodmanCLIWrapper.podman_run_command( + f"--rm {IMAGE_NAME} /bin/bash -c 'nginx -v'" + ).startswith(f"nginx version: nginx/{version}") + + @pytest.mark.parametrize( + "dockerfile", + [ + "Dockerfile", + "Dockerfile.s2i" + ] + ) + def test_dockerfiles(self, app, dockerfile): + version = VERSION.replace("-micro", "") + dp = DockerfileProcessor(dockerfile_path=f"{TEST_DIR}/examples/{dockerfile}") + dp.update_env_in_dockerfile(version=version, what_to_replace="ENV NGINX_VERSION") + dp.update_variable_in_dockerfile(version=version, variable="NGINX_VERSION") + new_docker_file = dp.create_temp_dockerfile() + + assert app.build_test_container( + dockerfile=new_docker_file, app_url="https://github.com/sclorg/nginx-container.git", + app_dir="nginx-container" + ) + assert app.test_app_dockerfile() + cip = app.get_cip() + assert cip + assert app.test_response(url=f"{cip}", expected_code=200, + expected_output="NGINX is working") diff --git a/test/test_container_example_app.py b/test/test_container_example_app.py new file mode 100644 index 00000000..8628d666 --- /dev/null +++ b/test/test_container_example_app.py @@ -0,0 +1,109 @@ +import os +import sys +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 check_variables, ContainerTestLibUtils +from container_ci_suite.engines.container import ContainerImage +from constants import return_app_name + + +if not check_variables(): + print("At least one variable from OS, VERSION is missing.") + sys.exit(1) +TEST_DIR = Path(os.path.abspath(os.path.dirname(__file__))) +VERSION = os.getenv("VERSION") +OS = os.getenv("TARGET").lower() +IMAGE_NAME = os.getenv("IMAGE_NAME") +if not IMAGE_NAME: + print(f"Built container for version {VERSION} on OS {OS} does not exist.") + sys.exit(1) +perl_test_app = os.path.join(TEST_DIR, "perl-test-app") +start_hook_test_app = os.path.join(TEST_DIR, "start-hook-test-app") + + +@pytest.fixture(scope="module", params=[start_hook_test_app]) +def example_app_test(request): + container_lib = ContainerTestLib(IMAGE_NAME) + app_name = return_app_name(request) + s2i_app = container_lib.build_as_df( + app_path=request.param, + s2i_args="--pull-policy=never", + src_image=IMAGE_NAME, + dst_image=f"{IMAGE_NAME}-{app_name}" + ) + s2i_app.set_new_image(image_name=f"{IMAGE_NAME}-{app_name}") + yield s2i_app + s2i_app.clean_containers() + +@pytest.fixture(scope="module", params=[perl_test_app]) +def example_perl_test(request): + container_lib = ContainerTestLib(IMAGE_NAME) + app_name = return_app_name(request) + s2i_app = container_lib.build_as_df( + app_path=request.param, + s2i_args="--pull-policy=never", + src_image=IMAGE_NAME, + dst_image=f"{IMAGE_NAME}-{app_name}" + ) + s2i_app.set_new_image(image_name=f"{IMAGE_NAME}-{app_name}") + yield s2i_app + s2i_app.clean_containers() + + +class TestNginxExampleAppContainer: + + def test_run_app_test(self, example_app_test): + version = VERSION.replace("-micro", "") + cid_file_name = example_app_test.app_name + assert example_app_test.create_container(cid_file_name=cid_file_name, container_args="--user 10001") + assert ContainerImage.wait_for_cid(cid_file_name=cid_file_name) + cid = example_app_test.get_cid(cid_file_name=cid_file_name) + assert cid + cip = example_app_test.get_cip(cid_file_name=cid_file_name) + assert cip + command = PodmanCLIWrapper.podman_get_file_content( + cid_file_name=cid, filename="/opt/app-root/etc/nginx.d/default.conf" + ) + assert ContainerTestLibUtils.check_regexp_output(regexp_to_check="resolver", logs_to_check=command) + assert not ContainerTestLibUtils.check_regexp_output(regexp_to_check="DNS_SERVER", logs_to_check=command) + assert PodmanCLIWrapper.podman_run_command( + f"--rm {example_app_test.image_name} /bin/bash -c 'nginx -v'" + ).startswith(f"nginx version: nginx/{version}") + assert example_app_test.test_response( + url=f"http://{cip}", expected_output="NGINX is working" + ) + assert example_app_test.test_response( + url=f"http://{cip}", expected_output="NGINX2 is working", + host="localhost2" + ) + assert example_app_test.test_response( + url=f"http://{cip}", expected_code=404, + page="/nginx-cfg/default.conf" + ) + + +class TestNginxExamplePerlAppContainer: + + def test_run_app_test(self, example_perl_test): + if VERSION.endswith("-micro"): + pytest.skip("Run the chosen tests (not for micro variant which lacks perl)") + cid_file_name = example_perl_test.app_name + example_perl_test.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file_name}") + assert example_perl_test.create_container(cid_file_name=cid_file_name, container_args="--user 10001") + cid = example_perl_test.get_cid(cid_file_name=cid_file_name) + assert cid + cip = example_perl_test.get_cip(cid_file_name=cid_file_name) + assert cip + perl_version = PodmanCLIWrapper.podman_exec_bash_command(cid_file_name=cid, cmd="perl -e 'print \"$^V\"'") + assert example_perl_test.test_response( + url=f"http://{cip}", port=8080, + expected_output=f"X-Perl-Version: {perl_version}" + ) + assert example_perl_test.test_response( + url=f"http://{cip}", port=8080, page="/perl", expected_output="Perl location handler is working" + ) + diff --git a/test/test_container_log.py b/test/test_container_log.py new file mode 100644 index 00000000..04d15412 --- /dev/null +++ b/test/test_container_log.py @@ -0,0 +1,95 @@ +import os +import sys +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 check_variables, ContainerTestLibUtils, get_file_content + + +if not check_variables(): + print("At least one variable from OS, VERSION is missing.") + sys.exit(1) +TEST_DIR = Path(os.path.abspath(os.path.dirname(__file__))) +VERSION = os.getenv("VERSION") +OS = os.getenv("TARGET").lower() +IMAGE_NAME = os.getenv("IMAGE_NAME") +if not IMAGE_NAME: + print(f"Built container for version {VERSION} on OS {OS} does not exist.") + sys.exit(1) +test_app = os.path.join(TEST_DIR, "test-app") + + +@pytest.fixture(scope="module", params=[test_app]) +def s2i_log_test(request): + container_lib = ContainerTestLib(IMAGE_NAME) + app_name = os.path.basename(request.param) + s2i_app = container_lib.build_as_df( + app_path=request.param, + s2i_args="--pull-policy=never", + src_image=IMAGE_NAME, + dst_image=f"{IMAGE_NAME}-{app_name}" + ) + yield s2i_app + s2i_app.clean_containers() + + +class TestNginxLogContainer: + + # test_log_output + def test_log_output(self, s2i_log_test): + cid_file_name = "test-app" + s2i_log_test.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file_name}") + assert s2i_log_test.create_container( + cid_file_name=cid_file_name, + container_args=f"--user 10001" + ) + cid = s2i_log_test.get_cid(cid_file_name=cid_file_name) + assert cid + cip = s2i_log_test.get_cip(cid_file_name=cid_file_name) + assert s2i_log_test.test_response( + url=f"http://{cip}", port=8080, expected_output="NGINX is working" + ) + assert '"GET / HTTP/1.1" 200' in s2i_log_test.get_logs(cid_file_name=cid_file_name) + assert s2i_log_test.test_response( + url=f"http://{cip}", port=8080, page="/nothing-at-all", expected_code=404 + ) + logs = s2i_log_test.get_logs(cid_file_name=cid_file_name) + assert logs + ContainerTestLibUtils.check_regexp_output( + regexp_to_check="open.*failed.*No such file or directory", + logs_to_check=logs + ) + + # test_log_volume_output + def test_log_volume_output(self, s2i_log_test): + cid_file_name = "test-app" + s2i_log_test.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file_name}") + assert s2i_log_test.create_container( + cid_file_name=cid_file_name, + container_args=f"-e NGINX_LOG_TO_VOLUME=y --user 10001" + ) + cid = s2i_log_test.get_cid(cid_file_name=cid_file_name) + assert cid + cip = s2i_log_test.get_cip(cid_file_name=cid_file_name) + assert s2i_log_test.test_response(url=f"http://{cip}", port=8080, expected_output="NGINX is working") + assert '"GET / HTTP/1.1" 200' in PodmanCLIWrapper.podman_get_file_content( + cid_file_name=cid, + filename="/var/log/nginx/access.log" + ) + assert s2i_log_test.test_response( + url=f"http://{cip}", port=8080, page="/nothing-at-all", expected_code=404 + ) + assert '"GET /nothing-at-all HTTP/1.1" 404' in PodmanCLIWrapper.podman_get_file_content( + cid_file_name=cid, + filename="/var/log/nginx/access.log" + ) + assert ContainerTestLibUtils.check_regexp_output( + regexp_to_check="open.*failed.*No such file or directory", + logs_to_check=PodmanCLIWrapper.podman_get_file_content( + cid_file_name=cid, + filename="/var/log/nginx/error.log" + ) + ) diff --git a/test/test_nginx_imagestream_s2i.py b/test/test_ocp_imagestream_s2i.py similarity index 100% rename from test/test_nginx_imagestream_s2i.py rename to test/test_ocp_imagestream_s2i.py diff --git a/test/test_nginx_imagestreams.py b/test/test_ocp_imagestreams.py similarity index 100% rename from test/test_nginx_imagestreams.py rename to test/test_ocp_imagestreams.py diff --git a/test/test_nginx_local_example.py b/test/test_ocp_local_example.py similarity index 100% rename from test/test_nginx_local_example.py rename to test/test_ocp_local_example.py diff --git a/test/test_nginx_remote_example.py b/test/test_ocp_remote_example.py similarity index 100% rename from test/test_nginx_remote_example.py rename to test/test_ocp_remote_example.py diff --git a/test/test_shared_helm_nginx_imagestreams.py b/test/test_ocp_shared_helm_imagestreams.py similarity index 100% rename from test/test_shared_helm_nginx_imagestreams.py rename to test/test_ocp_shared_helm_imagestreams.py diff --git a/test/test_shared_helm_nginx_template.py b/test/test_ocp_shared_helm_template.py similarity index 100% rename from test/test_shared_helm_nginx_template.py rename to test/test_ocp_shared_helm_template.py diff --git a/test/test_nginx_template_example_app.py b/test/test_ocp_template_example_app.py similarity index 100% rename from test/test_nginx_template_example_app.py rename to test/test_ocp_template_example_app.py