Ensure that network_mode and networks are not present at the same time

See
https://docs.docker.com/reference/compose-file/services/#network_mode

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas
2024-12-18 19:59:23 +02:00
parent a023dc145b
commit 2891be01d7
3 changed files with 17 additions and 0 deletions

View File

@ -59,6 +59,15 @@ class TestGetNetArgs(unittest.TestCase):
args = get_net_args(compose, container)
self.assertListEqual(expected_args, args)
def test_network_mode_and_networks_unsupported(self):
compose = get_networked_compose()
container = get_minimal_container()
container["networks"] = {"net0": {}}
container["network_mode"] = "none"
with self.assertRaises(ValueError):
get_net_args(compose, container)
def test_alias(self):
compose = get_networked_compose()
container = get_minimal_container()