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
c7948436
Kaydet (Commit)
c7948436
authored
Nis 24, 2015
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added tests for log_config param
üst
21d80b16
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
integration_test.py
tests/integration_test.py
+26
-1
utils_test.py
tests/utils_test.py
+21
-1
No files found.
tests/integration_test.py
Dosyayı görüntüle @
c7948436
...
...
@@ -348,6 +348,31 @@ class TestStartContainerWithFileBind(BaseTestCase):
os
.
unlink
(
mount_origin
)
class
TestCreateContainerWithLogConfig
(
BaseTestCase
):
def
runTest
(
self
):
config
=
docker
.
utils
.
LogConfig
(
type
=
docker
.
utils
.
LogConfig
.
types
.
SYSLOG
,
config
=
{
'key1'
:
'val1'
}
)
ctnr
=
self
.
client
.
create_container
(
'busybox'
,
[
'true'
],
host_config
=
create_host_config
(
log_config
=
config
)
)
self
.
assertIn
(
'Id'
,
ctnr
)
self
.
tmp_containers
.
append
(
ctnr
[
'Id'
])
self
.
client
.
start
(
ctnr
)
info
=
self
.
client
.
inspect_container
(
ctnr
)
self
.
assertIn
(
'HostConfig'
,
info
)
host_config
=
info
[
'HostConfig'
]
self
.
assertIn
(
'LogConfig'
,
host_config
)
log_config
=
host_config
[
'LogConfig'
]
self
.
assertIn
(
'Type'
,
log_config
)
self
.
assertEqual
(
log_config
[
'Type'
],
config
.
type
)
self
.
assertIn
(
'Config'
,
log_config
)
self
.
assertEqual
(
type
(
log_config
[
'Config'
]),
dict
)
self
.
assertEqual
(
log_config
[
'Config'
],
config
.
config
)
@unittest.skipIf
(
not
EXEC_DRIVER_IS_NATIVE
,
'Exec driver not native'
)
class
TestCreateContainerReadOnlyFs
(
BaseTestCase
):
def
runTest
(
self
):
...
...
@@ -958,7 +983,7 @@ class TestStartContainerWithVolumesFrom(BaseTestCase):
class
TestStartContainerWithUlimits
(
BaseTestCase
):
def
runTest
(
self
):
ulimit
=
docker
.
utils
.
Ulimit
(
'nofile'
,
4096
,
4096
)
ulimit
=
docker
.
utils
.
Ulimit
(
name
=
'nofile'
,
soft
=
4096
,
hard
=
4096
)
res0
=
self
.
client
.
create_container
(
'busybox'
,
'true'
)
container1_id
=
res0
[
'Id'
]
...
...
tests/utils_test.py
Dosyayı görüntüle @
c7948436
...
...
@@ -6,7 +6,7 @@ from docker.client import Client
from
docker.errors
import
DockerException
from
docker.utils
import
(
parse_repository_tag
,
parse_host
,
convert_filters
,
kwargs_from_env
,
create_host_config
,
Ulimit
create_host_config
,
Ulimit
,
LogConfig
)
from
docker.utils.ports
import
build_port_bindings
,
split_port
from
docker.auth
import
resolve_authconfig
...
...
@@ -141,6 +141,26 @@ class UtilsTest(base.BaseTestCase):
self
.
assertRaises
(
ValueError
,
lambda
:
Ulimit
(
name
=
'hello'
,
soft
=
'123'
))
self
.
assertRaises
(
ValueError
,
lambda
:
Ulimit
(
name
=
'hello'
,
hard
=
'456'
))
def
test_create_host_config_dict_logconfig
(
self
):
dct
=
{
'type'
:
LogConfig
.
types
.
SYSLOG
,
'config'
:
{
'key1'
:
'val1'
}}
config
=
create_host_config
(
log_config
=
dct
)
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
)
self
.
assertIn
(
'LogConfig'
,
config
)
self
.
assertTrue
(
isinstance
(
config
[
'LogConfig'
],
LogConfig
))
self
.
assertEqual
(
obj
,
config
[
'LogConfig'
])
def
test_logconfig_invalid_type
(
self
):
self
.
assertRaises
(
ValueError
,
lambda
:
LogConfig
(
type
=
'xxx'
,
config
=
{}))
self
.
assertRaises
(
ValueError
,
lambda
:
LogConfig
(
type
=
LogConfig
.
types
.
JSON
,
config
=
'helloworld'
))
def
test_resolve_authconfig
(
self
):
auth_config
=
{
'https://index.docker.io/v1/'
:
{
'auth'
:
'indexuser'
},
...
...
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