Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a test for restart_itde in a container #98

Merged
merged 11 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading