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
c89d3668
Kaydet (Commit)
c89d3668
authored
Kas 12, 2015
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #848 from docker/845-fix
Client.logs(tail=0) now shows no past logs (expected behavior)
üst
fe858f5e
0e13a0d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
19 deletions
+32
-19
container.py
docker/api/container.py
+1
-1
container_test.py
tests/integration/container_test.py
+31
-18
No files found.
docker/api/container.py
Dosyayı görüntüle @
c89d3668
...
@@ -192,7 +192,7 @@ class ContainerApiMixin(object):
...
@@ -192,7 +192,7 @@ class ContainerApiMixin(object):
'follow'
:
stream
and
1
or
0
,
'follow'
:
stream
and
1
or
0
,
}
}
if
utils
.
compare_version
(
'1.13'
,
self
.
_version
)
>=
0
:
if
utils
.
compare_version
(
'1.13'
,
self
.
_version
)
>=
0
:
if
tail
!=
'all'
and
(
not
isinstance
(
tail
,
int
)
or
tail
<
=
0
):
if
tail
!=
'all'
and
(
not
isinstance
(
tail
,
int
)
or
tail
<
0
):
tail
=
'all'
tail
=
'all'
params
[
'tail'
]
=
tail
params
[
'tail'
]
=
tail
url
=
self
.
_url
(
"/containers/{0}/logs"
,
container
)
url
=
self
.
_url
(
"/containers/{0}/logs"
,
container
)
...
...
tests/integration/container_test.py
Dosyayı görüntüle @
c89d3668
...
@@ -613,8 +613,8 @@ class LogsTest(api_test.BaseTestCase):
...
@@ -613,8 +613,8 @@ class LogsTest(api_test.BaseTestCase):
BUSYBOX
,
'echo {0}'
.
format
(
snippet
)
BUSYBOX
,
'echo {0}'
.
format
(
snippet
)
)
)
id
=
container
[
'Id'
]
id
=
container
[
'Id'
]
self
.
client
.
start
(
id
)
self
.
tmp_containers
.
append
(
id
)
self
.
tmp_containers
.
append
(
id
)
self
.
client
.
start
(
id
)
exitcode
=
self
.
client
.
wait
(
id
)
exitcode
=
self
.
client
.
wait
(
id
)
self
.
assertEqual
(
exitcode
,
0
)
self
.
assertEqual
(
exitcode
,
0
)
logs
=
self
.
client
.
logs
(
id
)
logs
=
self
.
client
.
logs
(
id
)
...
@@ -627,29 +627,29 @@ Line2'''
...
@@ -627,29 +627,29 @@ Line2'''
BUSYBOX
,
'echo "{0}"'
.
format
(
snippet
)
BUSYBOX
,
'echo "{0}"'
.
format
(
snippet
)
)
)
id
=
container
[
'Id'
]
id
=
container
[
'Id'
]
self
.
client
.
start
(
id
)
self
.
tmp_containers
.
append
(
id
)
self
.
tmp_containers
.
append
(
id
)
self
.
client
.
start
(
id
)
exitcode
=
self
.
client
.
wait
(
id
)
exitcode
=
self
.
client
.
wait
(
id
)
self
.
assertEqual
(
exitcode
,
0
)
self
.
assertEqual
(
exitcode
,
0
)
logs
=
self
.
client
.
logs
(
id
,
tail
=
1
)
logs
=
self
.
client
.
logs
(
id
,
tail
=
1
)
self
.
assertEqual
(
logs
,
(
'Line2
\n
'
)
.
encode
(
encoding
=
'ascii'
))
self
.
assertEqual
(
logs
,
'Line2
\n
'
.
encode
(
encoding
=
'ascii'
))
#
def test_logs_streaming(self):
def
test_logs_streaming
(
self
):
#
snippet = 'Flowering Nights (Sakuya Iyazoi)'
snippet
=
'Flowering Nights (Sakuya Iyazoi)'
#
container = self.client.create_container(
container
=
self
.
client
.
create_container
(
#
BUSYBOX, 'echo {0}'.format(snippet)
BUSYBOX
,
'echo {0}'
.
format
(
snippet
)
#
)
)
#
id = container['Id']
id
=
container
[
'Id'
]
# self.client.start
(id)
self
.
tmp_containers
.
append
(
id
)
# self.tmp_containers.append
(id)
self
.
client
.
start
(
id
)
# logs = bytes() if six.PY3 else str
()
logs
=
six
.
binary_type
()
#
for chunk in self.client.logs(id, stream=True):
for
chunk
in
self
.
client
.
logs
(
id
,
stream
=
True
):
#
logs += chunk
logs
+=
chunk
#
exitcode = self.client.wait(id)
exitcode
=
self
.
client
.
wait
(
id
)
#
self.assertEqual(exitcode, 0)
self
.
assertEqual
(
exitcode
,
0
)
#
self.assertEqual(logs, (snippet + '\n').encode(encoding='ascii'))
self
.
assertEqual
(
logs
,
(
snippet
+
'
\n
'
)
.
encode
(
encoding
=
'ascii'
))
def
test_logs_with_dict_instead_of_id
(
self
):
def
test_logs_with_dict_instead_of_id
(
self
):
snippet
=
'Flowering Nights (Sakuya Iyazoi)'
snippet
=
'Flowering Nights (Sakuya Iyazoi)'
...
@@ -657,13 +657,26 @@ Line2'''
...
@@ -657,13 +657,26 @@ Line2'''
BUSYBOX
,
'echo {0}'
.
format
(
snippet
)
BUSYBOX
,
'echo {0}'
.
format
(
snippet
)
)
)
id
=
container
[
'Id'
]
id
=
container
[
'Id'
]
self
.
client
.
start
(
id
)
self
.
tmp_containers
.
append
(
id
)
self
.
tmp_containers
.
append
(
id
)
self
.
client
.
start
(
id
)
exitcode
=
self
.
client
.
wait
(
id
)
exitcode
=
self
.
client
.
wait
(
id
)
self
.
assertEqual
(
exitcode
,
0
)
self
.
assertEqual
(
exitcode
,
0
)
logs
=
self
.
client
.
logs
(
container
)
logs
=
self
.
client
.
logs
(
container
)
self
.
assertEqual
(
logs
,
(
snippet
+
'
\n
'
)
.
encode
(
encoding
=
'ascii'
))
self
.
assertEqual
(
logs
,
(
snippet
+
'
\n
'
)
.
encode
(
encoding
=
'ascii'
))
def
test_logs_with_tail_0
(
self
):
snippet
=
'Flowering Nights (Sakuya Iyazoi)'
container
=
self
.
client
.
create_container
(
BUSYBOX
,
'echo "{0}"'
.
format
(
snippet
)
)
id
=
container
[
'Id'
]
self
.
tmp_containers
.
append
(
id
)
self
.
client
.
start
(
id
)
exitcode
=
self
.
client
.
wait
(
id
)
self
.
assertEqual
(
exitcode
,
0
)
logs
=
self
.
client
.
logs
(
id
,
tail
=
0
)
self
.
assertEqual
(
logs
,
''
.
encode
(
encoding
=
'ascii'
))
class
DiffTest
(
api_test
.
BaseTestCase
):
class
DiffTest
(
api_test
.
BaseTestCase
):
def
test_diff
(
self
):
def
test_diff
(
self
):
...
...
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