Skip to content

Commit 40cd8ae

Browse files
authored
Adding a test for restart_itde in a container (#98)
* making mypy happy * linting errors only * Adding intermediate status checks in the restart_itde test * Adding failure messages to the test * debugging the test * debugging the test * debugging the test * debugging the test * debugging the test * debugging the test * restoring all integration tests
1 parent c2ff207 commit 40cd8ae

File tree

5 files changed

+398
-275
lines changed

5 files changed

+398
-275
lines changed

doc/changes/changes_0.2.9.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ Post-release fixes.
1010
- Enables fingerprints in the host name.
1111
- Handles correctly special characters in the password.
1212
* #89: Connecting a new AI-Lab container to the Docker DB network when the latter container restarts.
13-
* #93: Refactoring the ITDE manager interface.
13+
* #93: Refactoring the ITDE manager interface.
14+
* #94: Adding an integration test for restart_itde() in a container.
15+
* #95: Adding an integration test for get_itde_status() in a container.

exasol/nb_connector/itde_manager.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@ def _add_current_container_to_db_network(network_name: str) -> None:
105105
if not container:
106106
return
107107
network = _get_docker_network(docker_client, network_name)
108-
if network and (container not in network.containers):
108+
if network and not _is_container_connected_to_network(container, network):
109109
network.connect(container.id)
110110

111111

112+
def _is_container_connected_to_network(container, network) -> bool:
113+
network.reload()
114+
return container in network.containers
115+
116+
112117
def _is_current_container_visible(network_name: str) -> bool:
113118
"""
114119
For the Docker Edition returns True if the current (AI-Lab) container
@@ -123,7 +128,7 @@ def _is_current_container_visible(network_name: str) -> bool:
123128
network = _get_docker_network(docker_client, network_name)
124129
if not network:
125130
return False
126-
return container in network.containers
131+
return _is_container_connected_to_network(container, network)
127132

128133

129134
def _get_docker_network(docker_client: docker.DockerClient, network_name: str) -> Optional[Network]:

0 commit comments

Comments
 (0)