Skip to content

Commit

Permalink
Adding a test for restart_itde in a container (#98)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ahsimb authored Apr 3, 2024
1 parent c2ff207 commit 40cd8ae
Show file tree
Hide file tree
Showing 5 changed files with 398 additions and 275 deletions.
4 changes: 3 additions & 1 deletion doc/changes/changes_0.2.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Post-release fixes.
- Enables fingerprints in the host name.
- Handles correctly special characters in the password.
* #89: Connecting a new AI-Lab container to the Docker DB network when the latter container restarts.
* #93: Refactoring the ITDE manager interface.
* #93: Refactoring the ITDE manager interface.
* #94: Adding an integration test for restart_itde() in a container.
* #95: Adding an integration test for get_itde_status() in a container.
9 changes: 7 additions & 2 deletions exasol/nb_connector/itde_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ def _add_current_container_to_db_network(network_name: str) -> None:
if not container:
return
network = _get_docker_network(docker_client, network_name)
if network and (container not in network.containers):
if network and not _is_container_connected_to_network(container, network):
network.connect(container.id)


def _is_container_connected_to_network(container, network) -> bool:
network.reload()
return container in network.containers


def _is_current_container_visible(network_name: str) -> bool:
"""
For the Docker Edition returns True if the current (AI-Lab) container
Expand All @@ -123,7 +128,7 @@ def _is_current_container_visible(network_name: str) -> bool:
network = _get_docker_network(docker_client, network_name)
if not network:
return False
return container in network.containers
return _is_container_connected_to_network(container, network)


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

0 comments on commit 40cd8ae

Please sign in to comment.