Skip to content

Commit e8c052b

Browse files
committed
Fix docker test - checking iptables is disabled.
docker system info (v27.4.1) always reports true for "BridgeNfIptables" and "BridgeNfIp6tables" regardless of the value we set for "iptables" in /etc/docker/daemon.json. The iptables rules correctly follow the configuration so we test on their presence instead.
1 parent 1902a10 commit e8c052b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

stackhpc_cloud_tests/host/test_docker.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,14 @@ def test_ip_forwarding_disabled(docker_info):
8686
assert not docker_info["IPv4Forwarding"]
8787

8888

89-
def test_iptables_disabled(docker_info):
89+
def test_iptables_disabled(host):
9090
"""Check that IPTables manipulation is disabled."""
91-
assert not docker_info["BridgeNfIptables"]
92-
assert not docker_info["BridgeNfIp6tables"]
93-
91+
# (MaxN) "docker system info" for version 27.4.1 will report "true" for "BridgeNfIptables" and "BridgeNfIp6tables"
92+
# regardless of the setting of "iptables" in /etc/docker/daemon.json,
93+
# however correct creation of iptables rules will follow this setting - so test on the iptables rules instead.
94+
iptables_chains = host.check_output("iptables -L")
95+
assert "FORWARD" in iptables_chains
96+
assert "DOCKER" not in iptables_chains
9497

9598
def test_live_restore_enabled(docker_info):
9699
"""Check that live restore is enabled."""

0 commit comments

Comments
 (0)