Skip to content

Commit 3527c29

Browse files
committed
Do not run Perl test on micro image because
it lacks with perl Do not use micro version, but only a VERSION Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent a9b364b commit 3527c29

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

test/test_container_application.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class TestNginxApplicationContainer:
4343

4444
# test_application
4545
def test_application(self, app):
46+
version = VERSION.replace("-micro", "")
4647
cid_file_name = "test-app"
4748
app.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file_name}")
4849
assert app.create_container(
@@ -52,7 +53,7 @@ def test_application(self, app):
5253
cip = app.get_cip(cid_name=cid_file_name)
5354
assert PodmanCLIWrapper.podman_run_command(
5455
f"--rm {app.image_name} /bin/bash -c 'nginx -v'"
55-
).startswith(f"nginx version: nginx/{VERSION}")
56+
).startswith(f"nginx version: nginx/{version}")
5657
assert app.test_response(
5758
url=f"http://{cip}", expected_output="NGINX is working"
5859
)
@@ -72,6 +73,7 @@ def test_application(self, app):
7273

7374
# test_application_user
7475
def test_application_user(self, app):
76+
version = VERSION.replace("-micro", "")
7577
cid_file_name = "test-app"
7678
app.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file_name}")
7779
assert app.create_container(
@@ -81,7 +83,7 @@ def test_application_user(self, app):
8183
cip = app.get_cip(cid_name=cid_file_name)
8284
assert PodmanCLIWrapper.podman_run_command(
8385
f"--rm {app.image_name} /bin/bash -c 'nginx -v'"
84-
).startswith(f"nginx version: nginx/{VERSION}")
86+
).startswith(f"nginx version: nginx/{version}")
8587
assert app.test_response(
8688
url=f"http://{cip}", expected_output="NGINX is working"
8789
)

test/test_container_basics.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
IMAGE_NAME = os.getenv("IMAGE_NAME", None)
2020
OS = os.getenv("TARGET", None)
2121

22+
2223
image_name = IMAGE_NAME.split(":")[0]
2324
image_tag = IMAGE_NAME.split(":")[1]
2425
test_dir = os.path.join(os.getcwd())
@@ -49,17 +50,11 @@ def test_docker_run_usage(self):
4950
) == 0
5051

5152

52-
# test_scl_usage
53-
@pytest.mark.parametrize(
54-
"command,expected",
55-
[
56-
("nginx -v", f"nginx version: nginx/{VERSION}"),
57-
]
58-
)
59-
def test_scl_usage(self, command, expected):
53+
def test_scl_usage(self):
54+
version = VERSION.replace("-micro", "")
6055
assert PodmanCLIWrapper.podman_run_command(
61-
f"--rm {IMAGE_NAME} /bin/bash -c '{command}'"
62-
).startswith(expected)
56+
f"--rm {IMAGE_NAME} /bin/bash -c 'nginx -v'"
57+
).startswith(f"nginx version: nginx/{version}")
6358

6459
@pytest.mark.parametrize(
6560
"dockerfile",

test/test_container_example_app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def example_perl_test(request):
6666
class TestNginxExampleAppContainer:
6767

6868
def test_run_app_test(self, example_app_test):
69+
version = VERSION.replace("-micro", "")
6970
cid_file = example_app_test.app_name
7071
assert example_app_test.create_container(cid_file=cid_file, container_args="--user 10001")
7172
assert ContainerImage.wait_for_cid(cid_file=cid_file)
@@ -79,7 +80,7 @@ def test_run_app_test(self, example_app_test):
7980
assert not ContainerTestLibUtils.check_regexp_output(regexp_to_check="DNS_SERVER", logs_to_check=command)
8081
assert PodmanCLIWrapper.podman_run_command(
8182
f"--rm {example_app_test.image_name} /bin/bash -c 'nginx -v'"
82-
).startswith(f"nginx version: nginx/{VERSION}")
83+
).startswith(f"nginx version: nginx/{version}")
8384
assert example_app_test.test_response(
8485
url=f"http://{cip}", expected_output="NGINX is working"
8586
)
@@ -96,8 +97,9 @@ def test_run_app_test(self, example_app_test):
9697
class TestNginxExamplePerlAppContainer:
9798

9899
def test_run_app_test(self, example_perl_test):
100+
if VERSION.endswith("-micro"):
101+
pytest.skip("Run the chosen tests (not for micro variant which lacks perl)")
99102
cid_file = example_perl_test.app_name
100-
print(cid_file)
101103
example_perl_test.set_new_image(image_name=f"{IMAGE_NAME}-{cid_file}")
102104
assert example_perl_test.create_container(cid_file=cid_file, container_args="--user 10001")
103105
cid = example_perl_test.get_cid(cid_name=cid_file)

0 commit comments

Comments
 (0)