fix(docker): fail closed on network address scan errors
This commit is contained in:
@@ -7,6 +7,8 @@ from pathlib import Path
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from bot_bottle.backend.docker.consolidated_launch import (
|
||||
ConsolidatedLaunchError,
|
||||
_network_container_ips,
|
||||
launch_consolidated,
|
||||
deprovision_consolidated,
|
||||
)
|
||||
@@ -86,6 +88,16 @@ class TestLaunchConsolidated(unittest.TestCase):
|
||||
client.teardown_bottle.assert_called_once_with("b1") # no orphan left
|
||||
|
||||
|
||||
class TestNetworkContainerIps(unittest.TestCase):
|
||||
def test_fails_closed_when_network_inspection_fails(self) -> None:
|
||||
result = Mock(returncode=1, stdout="", stderr="daemon unavailable")
|
||||
with (
|
||||
patch(f"{_MOD}.run_docker", return_value=result),
|
||||
self.assertRaisesRegex(ConsolidatedLaunchError, "daemon unavailable"),
|
||||
):
|
||||
_network_container_ips("bot-bottle-gateway")
|
||||
|
||||
|
||||
class TestTeardownConsolidated(unittest.TestCase):
|
||||
def test_deregisters_and_deprovisions(self) -> None:
|
||||
client = Mock()
|
||||
|
||||
Reference in New Issue
Block a user