Commit 16832e4f authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test] Fix docker network object handling

The network created during a test run was not properly deleted.
parent edc92cbe
......@@ -57,6 +57,7 @@ DOCKER_NETWORK_TEST_ENABLED = (
os.environ.get("DOCKER_NETWORK_TEST_ENABLED", False) == "True"
)
network_name = os.environ.get("DOCKER_TEST_NETWORK", "beat_core_test_network")
global network
network = None
# Setup the logging system
......@@ -90,6 +91,8 @@ def setup_package():
if DOCKER_NETWORK_TEST_ENABLED:
import docker
global network
client = docker.from_env()
try:
network = client.networks.get(network_name)
......@@ -112,5 +115,6 @@ def teardown_package():
shutil.rmtree(prefix_folder)
if DOCKER_NETWORK_TEST_ENABLED:
global network
if network:
network.remove()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment