Skip to content
Merged
1 change: 1 addition & 0 deletions 20-minimal/test/__init__.py
1 change: 1 addition & 0 deletions 20-minimal/test/conftest.py
1 change: 1 addition & 0 deletions 20-minimal/test/run-pytest
1 change: 1 addition & 0 deletions 20-minimal/test/test-fips
1 change: 1 addition & 0 deletions 20-minimal/test/test_container_apps.py
1 change: 1 addition & 0 deletions 20-minimal/test/test_container_basics.py
1 change: 1 addition & 0 deletions 22-minimal/test/__init__.py
1 change: 1 addition & 0 deletions 22-minimal/test/conftest.py
1 change: 1 addition & 0 deletions 22-minimal/test/run-pytest
1 change: 1 addition & 0 deletions 22-minimal/test/test-fips
1 change: 1 addition & 0 deletions 22-minimal/test/test_container_apps.py
1 change: 1 addition & 0 deletions 22-minimal/test/test_container_basics.py
1 change: 1 addition & 0 deletions 24-minimal/test/__init__.py
1 change: 1 addition & 0 deletions 24-minimal/test/conftest.py
1 change: 1 addition & 0 deletions 24-minimal/test/run-pytest
1 change: 1 addition & 0 deletions 24-minimal/test/test-fips
1 change: 1 addition & 0 deletions 24-minimal/test/test_container_apps.py
1 change: 1 addition & 0 deletions 24-minimal/test/test_container_basics.py
66 changes: 66 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import os
import sys

from collections import namedtuple
from pathlib import Path
from pytest import skip

from container_ci_suite.utils import check_variables

if not check_variables():
sys.exit(1)

OS = os.getenv("TARGET").lower()
VERSION = os.getenv("VERSION")
IMAGE_TAG = "15-c9s"
PGSQL_IMAGE_TAG = f"postgresql:{IMAGE_TAG}"
DEPLOYED_PGSQL_IMAGE = f"quay.io/sclorg/postgresql-{IMAGE_TAG}"
TAGS = {
"rhel8": "-ubi8",
"rhel9": "-ubi9",
"rhel10": "-ubi10",
}
PSQL_TAGS = {
"rhel8": "-el8",
"rhel9": "-el9",
"rhel10": "-el10",
}

Vars = namedtuple(
"Vars",
[
"OS",
"VERSION",
"TAG",
"IMAGE_TAG",
"PSQL_TAGS",
"PGSQL_IMAGE_TAG",
"DEPLOYED_PGSQL_IMAGE",
"IMAGE_NAME",
"IS_MINIMAL",
"VERSION_NO_MINIMAL",
"SHORT_VERSION",
"TEST_DIR",
],
)


VARS = Vars(
OS=OS,
VERSION=VERSION,
TAG=TAGS.get(OS),
IMAGE_TAG=IMAGE_TAG,
PSQL_TAGS=PSQL_TAGS.get(OS),
PGSQL_IMAGE_TAG=PGSQL_IMAGE_TAG,
DEPLOYED_PGSQL_IMAGE=DEPLOYED_PGSQL_IMAGE,
IMAGE_NAME=os.getenv("IMAGE_NAME"),
IS_MINIMAL="minimal" in VERSION,
VERSION_NO_MINIMAL=VERSION.replace("-minimal", ""),
SHORT_VERSION=VERSION.replace("-minimal", "").replace(".", ""),
TEST_DIR=Path(__file__).parent.absolute(),
)


def skip_for_minimal():
if "minimal" in VARS.VERSION:
skip("This test is not available for NodeJS minimal container")
5 changes: 0 additions & 5 deletions test/constants.py

This file was deleted.

2 changes: 1 addition & 1 deletion test/run-openshift-pytest
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions test/run-pytest
Original file line number Diff line number Diff line change
@@ -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 httpd
# 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
3 changes: 3 additions & 0 deletions test/test-fips/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const crypto = require('crypto');

process.exit(crypto.getFips());
4 changes: 2 additions & 2 deletions test/test-lib-nodejs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,12 @@ function test_nodejs_fips_mode() {
if [[ "$is_fips_enabled" == "0" ]]; then
# FIPS disabled -- crypto.getFips() should return 0
echo "Fips should be disabled"
docker run --rm ${IMAGE_NAME}-testfips /bin/bash -c "node -e 'const crypto = require(\"crypto\"); process.exit(crypto.getFips());'"
docker run --rm ${IMAGE_NAME}-testfips /bin/bash -c "node test.js"
ct_check_testcase_result "$?"
else
# FIPS enabled -- crypto.getFips() should return 1
echo "Fips should be enabled"
docker run --rm ${IMAGE_NAME}-testfips /bin/bash -c "! node -e 'const crypto = require(\"crypto\"); process.exit(crypto.getFips());'"
docker run --rm ${IMAGE_NAME}-testfips /bin/bash -c "! node test.js"
ct_check_testcase_result "$?"
fi
}
Expand Down
Loading