Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
8c86aa90
Kaydet (Commit)
8c86aa90
authored
Kas 01, 2018
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update tests to properly dispose of client instances in tearDown
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
c9edc9c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
46 deletions
+48
-46
api_network_test.py
tests/integration/api_network_test.py
+1
-1
api_plugin_test.py
tests/integration/api_plugin_test.py
+8
-8
api_swarm_test.py
tests/integration/api_swarm_test.py
+1
-2
base.py
tests/integration/base.py
+38
-35
No files found.
tests/integration/api_network_test.py
Dosyayı görüntüle @
8c86aa90
...
@@ -8,8 +8,8 @@ from .base import BaseAPIIntegrationTest, BUSYBOX
...
@@ -8,8 +8,8 @@ from .base import BaseAPIIntegrationTest, BUSYBOX
class
TestNetworks
(
BaseAPIIntegrationTest
):
class
TestNetworks
(
BaseAPIIntegrationTest
):
def
tearDown
(
self
):
def
tearDown
(
self
):
super
(
TestNetworks
,
self
)
.
tearDown
()
self
.
client
.
leave_swarm
(
force
=
True
)
self
.
client
.
leave_swarm
(
force
=
True
)
super
(
TestNetworks
,
self
)
.
tearDown
()
def
create_network
(
self
,
*
args
,
**
kwargs
):
def
create_network
(
self
,
*
args
,
**
kwargs
):
net_name
=
random_name
()
net_name
=
random_name
()
...
...
tests/integration/api_plugin_test.py
Dosyayı görüntüle @
8c86aa90
...
@@ -3,7 +3,7 @@ import os
...
@@ -3,7 +3,7 @@ import os
import
docker
import
docker
import
pytest
import
pytest
from
.base
import
BaseAPIIntegrationTest
,
TEST_API_VERSION
from
.base
import
BaseAPIIntegrationTest
from
..helpers
import
requires_api_version
from
..helpers
import
requires_api_version
SSHFS
=
'vieux/sshfs:latest'
SSHFS
=
'vieux/sshfs:latest'
...
@@ -13,27 +13,27 @@ SSHFS = 'vieux/sshfs:latest'
...
@@ -13,27 +13,27 @@ SSHFS = 'vieux/sshfs:latest'
class
PluginTest
(
BaseAPIIntegrationTest
):
class
PluginTest
(
BaseAPIIntegrationTest
):
@classmethod
@classmethod
def
teardown_class
(
cls
):
def
teardown_class
(
cls
):
c
=
docker
.
APIClient
(
client
=
cls
.
get_client_instance
()
version
=
TEST_API_VERSION
,
timeout
=
60
,
**
docker
.
utils
.
kwargs_from_env
()
)
try
:
try
:
c
.
remove_plugin
(
SSHFS
,
force
=
True
)
c
lient
.
remove_plugin
(
SSHFS
,
force
=
True
)
except
docker
.
errors
.
APIError
:
except
docker
.
errors
.
APIError
:
pass
pass
def
teardown_method
(
self
,
method
):
def
teardown_method
(
self
,
method
):
client
=
self
.
get_client_instance
()
try
:
try
:
self
.
client
.
disable_plugin
(
SSHFS
)
client
.
disable_plugin
(
SSHFS
)
except
docker
.
errors
.
APIError
:
except
docker
.
errors
.
APIError
:
pass
pass
for
p
in
self
.
tmp_plugins
:
for
p
in
self
.
tmp_plugins
:
try
:
try
:
self
.
client
.
remove_plugin
(
p
,
force
=
True
)
client
.
remove_plugin
(
p
,
force
=
True
)
except
docker
.
errors
.
APIError
:
except
docker
.
errors
.
APIError
:
pass
pass
client
.
close
()
def
ensure_plugin_installed
(
self
,
plugin_name
):
def
ensure_plugin_installed
(
self
,
plugin_name
):
try
:
try
:
return
self
.
client
.
inspect_plugin
(
plugin_name
)
return
self
.
client
.
inspect_plugin
(
plugin_name
)
...
...
tests/integration/api_swarm_test.py
Dosyayı görüntüle @
8c86aa90
...
@@ -13,14 +13,13 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -13,14 +13,13 @@ class SwarmTest(BaseAPIIntegrationTest):
self
.
_unlock_key
=
None
self
.
_unlock_key
=
None
def
tearDown
(
self
):
def
tearDown
(
self
):
super
(
SwarmTest
,
self
)
.
tearDown
()
try
:
try
:
if
self
.
_unlock_key
:
if
self
.
_unlock_key
:
self
.
client
.
unlock_swarm
(
self
.
_unlock_key
)
self
.
client
.
unlock_swarm
(
self
.
_unlock_key
)
except
docker
.
errors
.
APIError
:
except
docker
.
errors
.
APIError
:
pass
pass
force_leave_swarm
(
self
.
client
)
force_leave_swarm
(
self
.
client
)
super
(
SwarmTest
,
self
)
.
tearDown
()
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_init_swarm_simple
(
self
):
def
test_init_swarm_simple
(
self
):
...
...
tests/integration/base.py
Dosyayı görüntüle @
8c86aa90
...
@@ -29,41 +29,44 @@ class BaseIntegrationTest(unittest.TestCase):
...
@@ -29,41 +29,44 @@ class BaseIntegrationTest(unittest.TestCase):
def
tearDown
(
self
):
def
tearDown
(
self
):
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
for
img
in
self
.
tmp_imgs
:
try
:
try
:
for
img
in
self
.
tmp_imgs
:
client
.
api
.
remove_image
(
img
)
try
:
except
docker
.
errors
.
APIError
:
client
.
api
.
remove_image
(
img
)
pass
except
docker
.
errors
.
APIError
:
for
container
in
self
.
tmp_containers
:
pass
try
:
for
container
in
self
.
tmp_containers
:
client
.
api
.
remove_container
(
container
,
force
=
True
,
v
=
True
)
try
:
except
docker
.
errors
.
APIError
:
client
.
api
.
remove_container
(
container
,
force
=
True
,
v
=
True
)
pass
except
docker
.
errors
.
APIError
:
for
network
in
self
.
tmp_networks
:
pass
try
:
for
network
in
self
.
tmp_networks
:
client
.
api
.
remove_network
(
network
)
try
:
except
docker
.
errors
.
APIError
:
client
.
api
.
remove_network
(
network
)
pass
except
docker
.
errors
.
APIError
:
for
volume
in
self
.
tmp_volumes
:
pass
try
:
for
volume
in
self
.
tmp_volumes
:
client
.
api
.
remove_volume
(
volume
)
try
:
except
docker
.
errors
.
APIError
:
client
.
api
.
remove_volume
(
volume
)
pass
except
docker
.
errors
.
APIError
:
pass
for
secret
in
self
.
tmp_secrets
:
try
:
for
secret
in
self
.
tmp_secrets
:
client
.
api
.
remove_secret
(
secret
)
try
:
except
docker
.
errors
.
APIError
:
client
.
api
.
remove_secret
(
secret
)
pass
except
docker
.
errors
.
APIError
:
pass
for
config
in
self
.
tmp_configs
:
try
:
for
config
in
self
.
tmp_configs
:
client
.
api
.
remove_config
(
config
)
try
:
except
docker
.
errors
.
APIError
:
client
.
api
.
remove_config
(
config
)
pass
except
docker
.
errors
.
APIError
:
pass
for
folder
in
self
.
tmp_folders
:
shutil
.
rmtree
(
folder
)
for
folder
in
self
.
tmp_folders
:
shutil
.
rmtree
(
folder
)
finally
:
client
.
close
()
class
BaseAPIIntegrationTest
(
BaseIntegrationTest
):
class
BaseAPIIntegrationTest
(
BaseIntegrationTest
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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