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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1.20/test/conftest.py
1 change: 1 addition & 0 deletions 1.20/test/run-pytest
1 change: 1 addition & 0 deletions 1.20/test/test_container_application.py
1 change: 1 addition & 0 deletions 1.20/test/test_container_basics.py
1 change: 1 addition & 0 deletions 1.20/test/test_container_example_apps.py
1 change: 0 additions & 1 deletion 1.20/test/test_nginx_imagestream_s2i.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.20/test/test_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.20/test/test_nginx_local_example.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.20/test/test_nginx_remote_example.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.20/test/test_ocp_imagestream_s2i.py
1 change: 1 addition & 0 deletions 1.20/test/test_ocp_imagestreams.py
1 change: 1 addition & 0 deletions 1.20/test/test_ocp_local_example.py
1 change: 1 addition & 0 deletions 1.20/test/test_ocp_remote_example.py
1 change: 1 addition & 0 deletions 1.20/test/test_ocp_shared_helm_imagestreams.py
1 change: 1 addition & 0 deletions 1.20/test/test_ocp_shared_helm_template.py
1 change: 1 addition & 0 deletions 1.20/test/test_ocp_template_example_app.py
1 change: 0 additions & 1 deletion 1.20/test/test_shared_helm_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.20/test/test_shared_helm_nginx_template.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.22/test/conftest.py
1 change: 0 additions & 1 deletion 1.22/test/constants.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.22/test/run-pytest
1 change: 1 addition & 0 deletions 1.22/test/test_container_application.py
1 change: 1 addition & 0 deletions 1.22/test/test_container_basics.py
1 change: 1 addition & 0 deletions 1.22/test/test_container_example_apps.py
1 change: 0 additions & 1 deletion 1.22/test/test_nginx_imagestream_s2i.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.22/test/test_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.22/test/test_nginx_local_example.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.22/test/test_nginx_remote_example.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.22/test/test_ocp_imagestream_s2i.py
1 change: 1 addition & 0 deletions 1.22/test/test_ocp_imagestreams.py
1 change: 1 addition & 0 deletions 1.22/test/test_ocp_local_example.py
1 change: 1 addition & 0 deletions 1.22/test/test_ocp_remote_example.py
1 change: 1 addition & 0 deletions 1.22/test/test_ocp_shared_helm_imagestreams.py
1 change: 1 addition & 0 deletions 1.22/test/test_ocp_shared_helm_template.py
1 change: 1 addition & 0 deletions 1.22/test/test_ocp_template_example_app.py
1 change: 0 additions & 1 deletion 1.22/test/test_shared_helm_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.22/test/test_shared_helm_nginx_template.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.24/test/conftest.py
1 change: 1 addition & 0 deletions 1.24/test/run-pytest
1 change: 1 addition & 0 deletions 1.24/test/test_container_application.py
1 change: 1 addition & 0 deletions 1.24/test/test_container_basics.py
1 change: 1 addition & 0 deletions 1.24/test/test_container_example_apps.py
1 change: 0 additions & 1 deletion 1.24/test/test_nginx_imagestream_s2i.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.24/test/test_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.24/test/test_nginx_local_example.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.24/test/test_nginx_remote_example.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.24/test/test_nginx_template_example_app.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.24/test/test_ocp_imagestream_s2i.py
1 change: 1 addition & 0 deletions 1.24/test/test_ocp_imagestreams.py
1 change: 1 addition & 0 deletions 1.24/test/test_ocp_local_example.py
1 change: 1 addition & 0 deletions 1.24/test/test_ocp_remote_example.py
1 change: 1 addition & 0 deletions 1.24/test/test_ocp_shared_helm_imagestreams.py
1 change: 1 addition & 0 deletions 1.24/test/test_ocp_shared_helm_template.py
1 change: 1 addition & 0 deletions 1.24/test/test_ocp_template_example_app.py
1 change: 0 additions & 1 deletion 1.24/test/test_shared_helm_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.24/test/test_shared_helm_nginx_template.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.26/test/conftest.py
1 change: 0 additions & 1 deletion 1.26/test/constants.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.26/test/run-pytest
1 change: 1 addition & 0 deletions 1.26/test/test_container_application.py
1 change: 1 addition & 0 deletions 1.26/test/test_container_basics.py
1 change: 1 addition & 0 deletions 1.26/test/test_container_example_apps.py
1 change: 0 additions & 1 deletion 1.26/test/test_nginx_imagestream_s2i.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.26/test/test_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.26/test/test_nginx_local_example.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.26/test/test_nginx_remote_example.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.26/test/test_nginx_template_example_app.py

This file was deleted.

1 change: 1 addition & 0 deletions 1.26/test/test_ocp_imagestream_s2i.py
1 change: 1 addition & 0 deletions 1.26/test/test_ocp_imagestreams.py
1 change: 1 addition & 0 deletions 1.26/test/test_ocp_local_example.py
1 change: 1 addition & 0 deletions 1.26/test/test_ocp_remote_example.py
1 change: 1 addition & 0 deletions 1.26/test/test_ocp_shared_helm_imagestreams.py
1 change: 1 addition & 0 deletions 1.26/test/test_ocp_shared_helm_template.py
1 change: 1 addition & 0 deletions 1.26/test/test_ocp_template_example_app.py
1 change: 0 additions & 1 deletion 1.26/test/test_shared_helm_nginx_imagestreams.py

This file was deleted.

1 change: 0 additions & 1 deletion 1.26/test/test_shared_helm_nginx_template.py

This file was deleted.

41 changes: 41 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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",
}

Vars = namedtuple(
"Vars", [
"OS", "TAG", "VERSION", "IMAGE_NAME", "VERSION_NO_MICRO", "SHORT_VERSION", "TEST_DIR"
]
)
OS = os.getenv("TARGET").lower()
VERSION = os.getenv("VERSION")
BRANCH_TO_TEST = "master"

VARS = Vars(
OS=OS,
TAG=TAGS.get(OS),
VERSION=VERSION,
IMAGE_NAME=os.getenv("IMAGE_NAME"),
VERSION_NO_MICRO=VERSION.replace("-micro", ""),
SHORT_VERSION=VERSION.replace("-micro", "").replace(".", ""),
TEST_DIR=Path(__file__).parent.absolute(),
)


def skip_clear_env_tests():
if VARS.OS == "rhel8" and VERSION == "8.2":
skip(f"Skipping clear env tests for {VARS.VERSION} on {VARS.OS}.")
5 changes: 0 additions & 5 deletions test/constants.py

This file was deleted.

2 changes: 1 addition & 1 deletion test/run
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,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


Expand Down
2 changes: 1 addition & 1 deletion test/run-openshift-pytest
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions test/run-pytest
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this is good for. The information about the last commit is usually available in the CI, and you typically don't need it in the output.


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
74 changes: 74 additions & 0 deletions test/test_container_application.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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

test_app = VARS.TEST_DIR / "test-app"


def build_s2i_app(app_path: Path) -> ContainerTestLib:
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 TestNginxApplicationContainer:

def setup_method(self):
self.s2i_app = build_s2i_app(app_path=test_app)

def teardown_method(self):
self.s2i_app.cleanup()

@pytest.mark.parametrize(
"container_arg",
[
"",
"--user 12345"
]
)
def test_application(self, container_arg):
"""
Test if container works under specific user
and not only with user --user 10001
"""
cid_file_name = "test-app"
assert self.s2i_app.create_container(
cid_file_name=cid_file_name,
container_args=f"--user 10001 {container_arg}"
)
cip = self.s2i_app.get_cip(cid_file_name=cid_file_name)
assert cip
# nginx -v returns proper version
assert f"nginx/{VARS.VERSION_NO_MICRO}" in PodmanCLIWrapper.podman_run_command_and_remove(
cid_file_name=f"{VARS.IMAGE_NAME}-{cid_file_name}",
cmd="nginx -v"
)
# Response code from HTTP url is 200 and contains proper output
assert self.s2i_app.test_response(
url=f"http://{cip}", expected_output="NGINX is working"
)
# Response code from HTTP url is 200 and contains proper output
assert self.s2i_app.test_response(
url=f"http://{cip}", expected_output="NGINX2 is working",
host="localhost2"
)
# Response code from HTTP url is 200 and contains proper output
assert self.s2i_app.test_response(
url=f"http://{cip}", expected_output="NGINX2 is working",
page="/aliased/index2.html"
)
# Response code from HTTP url is 404 and nginx-cfg/default.conf is not accessible
assert self.s2i_app.test_response(
url=f"http://{cip}", expected_code=404,
page="/nginx-cfg/default.conf"
)
Loading