From 464dfd84418d809bd090b4f7362d5400fa92e8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Rod=C3=A1k?= Date: Fri, 9 Aug 2024 14:54:19 +0200 Subject: [PATCH] Add test of container create with DNS option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Rodák --- .../integration/test_container_create.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/podman/tests/integration/test_container_create.py b/podman/tests/integration/test_container_create.py index fdd98c77..266a3c55 100644 --- a/podman/tests/integration/test_container_create.py +++ b/podman/tests/integration/test_container_create.py @@ -157,6 +157,26 @@ def test_container_ports(self): ) ) + def test_container_dns_option(self): + expected_dns_opt = ['edns0'] + + container = self.client.containers.create( + self.alpine_image, command=["cat", "/etc/resolv.conf"], dns_opt=expected_dns_opt + ) + self.containers.append(container) + + with self.subTest("Check HostConfig"): + self.assertEqual( + container.attrs.get('HostConfig', {}).get('DnsOptions'), expected_dns_opt + ) + + with self.subTest("Check content of /etc/resolv.conf"): + container.start() + container.wait() + self.assertTrue( + all([opt in b"\n".join(container.logs()).decode() for opt in expected_dns_opt]) + ) + def test_container_healthchecks(self): """Test passing various healthcheck options""" parameters = {