diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index d8305ab..0d66366 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -2,3 +2,7 @@ ## Changes +### Bug fixing + +* #143: itde_manager.bring_itde_up() fails if the container is not connected to the network + it is assumed to be connected to. diff --git a/exasol/nb_connector/itde_manager.py b/exasol/nb_connector/itde_manager.py index dde0ba8..e623bd7 100644 --- a/exasol/nb_connector/itde_manager.py +++ b/exasol/nb_connector/itde_manager.py @@ -153,7 +153,7 @@ def _remove_current_container_from_db_network(conf: Secrets): if not container: return network = _get_docker_network(docker_client, network_name) - if network: + if network and _is_container_connected_to_network(container, network): network.disconnect(container.id) diff --git a/test/integration/test_itde_manager_in_docker_container.py b/test/integration/test_itde_manager_in_docker_container.py index 176e940..bcbc8f6 100644 --- a/test/integration/test_itde_manager_in_docker_container.py +++ b/test/integration/test_itde_manager_in_docker_container.py @@ -147,7 +147,13 @@ def run_test(): secrets.save(AILabConfig.disk_size.value, "4") bring_itde_up(secrets) + # Remember the network name + network_name = secrets.get(AILabConfig.itde_network) take_itde_down(secrets) + # Restore the network name. This simulates the situation when a new AI-Lab container + # replaces an old one. It is not connected to the network, but the network name is + # nonetheless present in the secret store. + secrets.save(AILabConfig.itde_network, network_name) bring_itde_up(secrets) take_itde_down(secrets)