Skip to content

Commit 69acf3b

Browse files
committed
Fix missing symlink to conftest.py in each directory.
Fix skipping RHEL8 tests for FIPS. Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
1 parent 6a40ee4 commit 69acf3b

File tree

7 files changed

+25
-212
lines changed

7 files changed

+25
-212
lines changed

2.5/test/conftest.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

2.5/test/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/conftest.py

3.0/test/conftest.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

3.0/test/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/conftest.py

3.1/test/conftest.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

3.1/test/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/conftest.py

test/conftest.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from pathlib import Path
66
from collections import namedtuple
7-
from pytest import skip
87

98
from container_ci_suite.utils import check_variables
109

@@ -66,11 +65,3 @@ def fips_enabled():
6665
if os.path.exists("/proc/sys/crypto/fips_enabled"):
6766
return Path("/proc/sys/crypto/fips_enabled").read_text() == "1"
6867
return False
69-
70-
71-
def skip_fips_tests_rhel8():
72-
"""
73-
Skip FIPS tests on RHEL8.
74-
"""
75-
if VARS.OS == "rhel8":
76-
skip("Skipping FIPS tests on RHEL8 because FIPS is enabled.")

test/run-openshift-pytest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
THISDIR=$(dirname ${BASH_SOURCE[0]})
1010

11-
cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_*.py
11+
cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_ocp_*.py

test/test_container_application.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
test_ports = PodmanCLIWrapper.podman_inspect(
1616
field="{{range $key, $value := .Config.ExposedPorts }}{{$key}}{{end}}",
1717
src_image=VARS.IMAGE_NAME,
18-
).split("/")
18+
)
1919
print(f"The exposed ports are: {test_ports}")
2020

2121

@@ -75,7 +75,9 @@ def test_application(self):
7575
)
7676
)
7777
# Response code from HTTP url is 200
78-
assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0])
78+
assert self.s2i_app.test_response(
79+
url=f"http://{cip}", port=test_ports.split("/")[0]
80+
)
7981

8082

8183
class TestRubyPumaTestAppContainer:
@@ -115,7 +117,9 @@ def test_application(self):
115117
)
116118
)
117119
# Response code from HTTP url is 200
118-
assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0])
120+
assert self.s2i_app.test_response(
121+
url=f"http://{cip}", port=test_ports.split("/")[0]
122+
)
119123

120124

121125
class TestRubyRackTestAppContainer:
@@ -155,4 +159,6 @@ def test_application(self):
155159
)
156160
)
157161
# Response code from HTTP url is 200
158-
assert self.s2i_app.test_response(url=f"http://{cip}", port=test_ports[0])
162+
assert self.s2i_app.test_response(
163+
url=f"http://{cip}", port=test_ports.split("/")[0]
164+
)

test/test_container_fips.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import pytest
2+
13
from pathlib import Path
4+
25
from container_ci_suite.container_lib import ContainerTestLib
36
from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper
47

5-
from conftest import VARS, skip_fips_tests_rhel8, fips_enabled
8+
from conftest import VARS, fips_enabled
69

710
fips_test_app = VARS.TEST_DIR / "test-fips"
811

@@ -25,7 +28,7 @@ def build_fips_test_app(app_path: Path) -> ContainerTestLib:
2528
class TestRubyFipsModeContainer:
2629
"""
2730
Test if container works under specific user
28-
and not only with user --user 10001
31+
and not only with user --user 100001
2932
"""
3033

3134
def setup_method(self):
@@ -45,8 +48,8 @@ def test_fips_mode(self):
4548
Test if container works under specific user
4649
and not only with user --user 10001
4750
"""
48-
skip_fips_tests_rhel8()
49-
print(f"Is FIPS enabled? {fips_enabled()}")
51+
if VARS.OS == "rhel8":
52+
pytest.skip("Do not execute on RHEL8")
5053
if fips_enabled():
5154
output = PodmanCLIWrapper.podman_run_command_and_remove(
5255
cid_file_name={VARS.IMAGE_NAME},
@@ -79,14 +82,16 @@ def teardown_method(self):
7982
"""
8083
Cleanup the test environment.
8184
"""
82-
self.fips_app.cleanup()
85+
if self.fips_app:
86+
self.fips_app.cleanup()
8387

8488
def test_application(self):
8589
"""
8690
Test if container works under specific user
8791
and not only with user --user 100001
8892
"""
89-
skip_fips_tests_rhel8()
93+
if VARS.OS == "rhel8":
94+
pytest.skip("Do not execute on RHEL8")
9095
cid_file_name = self.fips_app.app_name
9196
assert self.fips_app.create_container(
9297
cid_file_name=cid_file_name, container_args="--user 100001"

0 commit comments

Comments
 (0)