mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-31 23:45:51 +02:00
tests/unit: Add unit tests for fixing CMD healthcheck
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
parent
76b3055934
commit
a983129e88
@ -694,3 +694,73 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
await container_to_args(c, cnt)
|
||||
|
||||
async def test_heathcheck_string(self):
|
||||
c = create_compose_mock()
|
||||
cnt = get_minimal_container()
|
||||
cnt["healthcheck"] = {
|
||||
"test": "cmd arg1 arg2",
|
||||
}
|
||||
|
||||
args = await container_to_args(c, cnt)
|
||||
self.assertEqual(
|
||||
args,
|
||||
[
|
||||
"--name=project_name_service_name1",
|
||||
"-d",
|
||||
"--network=bridge:alias=service_name",
|
||||
"--healthcheck-command",
|
||||
'["CMD-SHELL", "cmd arg1 arg2"]',
|
||||
"busybox",
|
||||
],
|
||||
)
|
||||
|
||||
async def test_heathcheck_cmd_args(self):
|
||||
c = create_compose_mock()
|
||||
cnt = get_minimal_container()
|
||||
cnt["healthcheck"] = {
|
||||
"test": ["CMD", "cmd", "arg1", "arg2"],
|
||||
}
|
||||
|
||||
args = await container_to_args(c, cnt)
|
||||
self.assertEqual(
|
||||
args,
|
||||
[
|
||||
"--name=project_name_service_name1",
|
||||
"-d",
|
||||
"--network=bridge:alias=service_name",
|
||||
"--healthcheck-command",
|
||||
'["cmd", "arg1", "arg2"]',
|
||||
"busybox",
|
||||
],
|
||||
)
|
||||
|
||||
async def test_heathcheck_cmd_shell(self):
|
||||
c = create_compose_mock()
|
||||
cnt = get_minimal_container()
|
||||
cnt["healthcheck"] = {
|
||||
"test": ["CMD-SHELL", "cmd arg1 arg2"],
|
||||
}
|
||||
|
||||
args = await container_to_args(c, cnt)
|
||||
self.assertEqual(
|
||||
args,
|
||||
[
|
||||
"--name=project_name_service_name1",
|
||||
"-d",
|
||||
"--network=bridge:alias=service_name",
|
||||
"--healthcheck-command",
|
||||
'["cmd arg1 arg2"]',
|
||||
"busybox",
|
||||
],
|
||||
)
|
||||
|
||||
async def test_heathcheck_cmd_shell_error(self):
|
||||
c = create_compose_mock()
|
||||
cnt = get_minimal_container()
|
||||
cnt["healthcheck"] = {
|
||||
"test": ["CMD-SHELL", "cmd arg1", "arg2"],
|
||||
}
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
await container_to_args(c, cnt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user