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
595965eb
Kaydet (Commit)
595965eb
authored
Agu 24, 2015
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adapt tests to new create_host_config usage
üst
4bd3c48e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
test.py
tests/test.py
+0
-0
utils_test.py
tests/utils_test.py
+19
-6
No files found.
tests/test.py
Dosyayı görüntüle @
595965eb
This diff is collapsed.
Click to expand it.
tests/utils_test.py
Dosyayı görüntüle @
595965eb
...
...
@@ -4,6 +4,7 @@ import unittest
import
tempfile
from
docker.client
import
Client
from
docker.constants
import
DEFAULT_DOCKER_API_VERSION
from
docker.errors
import
DockerException
from
docker.utils
import
(
parse_repository_tag
,
parse_host
,
convert_filters
,
kwargs_from_env
,
...
...
@@ -144,12 +145,16 @@ class UtilsTest(base.BaseTestCase):
self
.
assertEqual
(
convert_filters
(
filters
),
expected
)
def
test_create_empty_host_config
(
self
):
empty_config
=
create_host_config
(
network_mode
=
''
)
empty_config
=
create_host_config
(
network_mode
=
''
,
version
=
DEFAULT_DOCKER_API_VERSION
)
self
.
assertEqual
(
empty_config
,
{})
def
test_create_host_config_dict_ulimit
(
self
):
ulimit_dct
=
{
'name'
:
'nofile'
,
'soft'
:
8096
}
config
=
create_host_config
(
ulimits
=
[
ulimit_dct
])
config
=
create_host_config
(
ulimits
=
[
ulimit_dct
],
version
=
DEFAULT_DOCKER_API_VERSION
)
self
.
assertIn
(
'Ulimits'
,
config
)
self
.
assertEqual
(
len
(
config
[
'Ulimits'
]),
1
)
ulimit_obj
=
config
[
'Ulimits'
][
0
]
...
...
@@ -160,7 +165,9 @@ class UtilsTest(base.BaseTestCase):
def
test_create_host_config_dict_ulimit_capitals
(
self
):
ulimit_dct
=
{
'Name'
:
'nofile'
,
'Soft'
:
8096
,
'Hard'
:
8096
*
4
}
config
=
create_host_config
(
ulimits
=
[
ulimit_dct
])
config
=
create_host_config
(
ulimits
=
[
ulimit_dct
],
version
=
DEFAULT_DOCKER_API_VERSION
)
self
.
assertIn
(
'Ulimits'
,
config
)
self
.
assertEqual
(
len
(
config
[
'Ulimits'
]),
1
)
ulimit_obj
=
config
[
'Ulimits'
][
0
]
...
...
@@ -172,7 +179,9 @@ class UtilsTest(base.BaseTestCase):
def
test_create_host_config_obj_ulimit
(
self
):
ulimit_dct
=
Ulimit
(
name
=
'nofile'
,
soft
=
8096
)
config
=
create_host_config
(
ulimits
=
[
ulimit_dct
])
config
=
create_host_config
(
ulimits
=
[
ulimit_dct
],
version
=
DEFAULT_DOCKER_API_VERSION
)
self
.
assertIn
(
'Ulimits'
,
config
)
self
.
assertEqual
(
len
(
config
[
'Ulimits'
]),
1
)
ulimit_obj
=
config
[
'Ulimits'
][
0
]
...
...
@@ -186,14 +195,18 @@ class UtilsTest(base.BaseTestCase):
def
test_create_host_config_dict_logconfig
(
self
):
dct
=
{
'type'
:
LogConfig
.
types
.
SYSLOG
,
'config'
:
{
'key1'
:
'val1'
}}
config
=
create_host_config
(
log_config
=
dct
)
config
=
create_host_config
(
log_config
=
dct
,
version
=
DEFAULT_DOCKER_API_VERSION
)
self
.
assertIn
(
'LogConfig'
,
config
)
self
.
assertTrue
(
isinstance
(
config
[
'LogConfig'
],
LogConfig
))
self
.
assertEqual
(
dct
[
'type'
],
config
[
'LogConfig'
]
.
type
)
def
test_create_host_config_obj_logconfig
(
self
):
obj
=
LogConfig
(
type
=
LogConfig
.
types
.
SYSLOG
,
config
=
{
'key1'
:
'val1'
})
config
=
create_host_config
(
log_config
=
obj
)
config
=
create_host_config
(
log_config
=
obj
,
version
=
DEFAULT_DOCKER_API_VERSION
)
self
.
assertIn
(
'LogConfig'
,
config
)
self
.
assertTrue
(
isinstance
(
config
[
'LogConfig'
],
LogConfig
))
self
.
assertEqual
(
obj
,
config
[
'LogConfig'
])
...
...
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