Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.core
Commits
16832e4f
Commit
16832e4f
authored
Mar 15, 2019
by
Samuel GAIST
Browse files
[test] Fix docker network object handling
The network created during a test run was not properly deleted.
parent
edc92cbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/core/test/__init__.py
View file @
16832e4f
...
...
@@ -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
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment