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
6777c28d
Kaydet (Commit)
6777c28d
authored
Kas 01, 2018
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Clear error for cancellable streams over SSH
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
8c86aa90
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
daemon.py
docker/types/daemon.py
+11
-1
api_container_test.py
tests/integration/api_container_test.py
+4
-1
models_containers_test.py
tests/integration/models_containers_test.py
+3
-0
No files found.
docker/types/daemon.py
Dosyayı görüntüle @
6777c28d
...
@@ -5,6 +5,8 @@ try:
...
@@ -5,6 +5,8 @@ try:
except
ImportError
:
except
ImportError
:
import
urllib3
import
urllib3
from
..errors
import
DockerException
class
CancellableStream
(
object
):
class
CancellableStream
(
object
):
"""
"""
...
@@ -55,9 +57,17 @@ class CancellableStream(object):
...
@@ -55,9 +57,17 @@ class CancellableStream(object):
elif
hasattr
(
sock_raw
,
'_sock'
):
elif
hasattr
(
sock_raw
,
'_sock'
):
sock
=
sock_raw
.
_sock
sock
=
sock_raw
.
_sock
elif
hasattr
(
sock_fp
,
'channel'
):
# We're working with a paramiko (SSH) channel, which doesn't
# support cancelable streams with the current implementation
raise
DockerException
(
'Cancellable streams not supported for the SSH protocol'
)
else
:
else
:
sock
=
sock_fp
.
_sock
sock
=
sock_fp
.
_sock
if
isinstance
(
sock
,
urllib3
.
contrib
.
pyopenssl
.
WrappedSocket
):
if
hasattr
(
urllib3
.
contrib
,
'pyopenssl'
)
and
isinstance
(
sock
,
urllib3
.
contrib
.
pyopenssl
.
WrappedSocket
):
sock
=
sock
.
socket
sock
=
sock
.
socket
sock
.
shutdown
(
socket
.
SHUT_RDWR
)
sock
.
shutdown
(
socket
.
SHUT_RDWR
)
...
...
tests/integration/api_container_test.py
Dosyayı görüntüle @
6777c28d
...
@@ -883,6 +883,8 @@ Line2'''
...
@@ -883,6 +883,8 @@ Line2'''
assert
logs
==
(
snippet
+
'
\n
'
)
.
encode
(
encoding
=
'ascii'
)
assert
logs
==
(
snippet
+
'
\n
'
)
.
encode
(
encoding
=
'ascii'
)
@pytest.mark.timeout
(
5
)
@pytest.mark.timeout
(
5
)
@pytest.mark.skipif
(
os
.
environ
.
get
(
'DOCKER_HOST'
,
''
)
.
startswith
(
'ssh://'
),
reason
=
'No cancellable streams over SSH'
)
def
test_logs_streaming_and_follow_and_cancel
(
self
):
def
test_logs_streaming_and_follow_and_cancel
(
self
):
snippet
=
'Flowering Nights (Sakuya Iyazoi)'
snippet
=
'Flowering Nights (Sakuya Iyazoi)'
container
=
self
.
client
.
create_container
(
container
=
self
.
client
.
create_container
(
...
@@ -1255,7 +1257,8 @@ class AttachContainerTest(BaseAPIIntegrationTest):
...
@@ -1255,7 +1257,8 @@ class AttachContainerTest(BaseAPIIntegrationTest):
assert
output
==
'hello
\n
'
.
encode
(
encoding
=
'ascii'
)
assert
output
==
'hello
\n
'
.
encode
(
encoding
=
'ascii'
)
@pytest.mark.timeout
(
5
)
@pytest.mark.timeout
(
5
)
@pytest.mark.xfail
(
True
,
reason
=
'Cancellable events broken over SSH'
)
@pytest.mark.skipif
(
os
.
environ
.
get
(
'DOCKER_HOST'
,
''
)
.
startswith
(
'ssh://'
),
reason
=
'No cancellable streams over SSH'
)
def
test_attach_stream_and_cancel
(
self
):
def
test_attach_stream_and_cancel
(
self
):
container
=
self
.
client
.
create_container
(
container
=
self
.
client
.
create_container
(
BUSYBOX
,
'sh -c "echo hello && sleep 60"'
,
BUSYBOX
,
'sh -c "echo hello && sleep 60"'
,
...
...
tests/integration/models_containers_test.py
Dosyayı görüntüle @
6777c28d
import
os
import
tempfile
import
tempfile
import
threading
import
threading
...
@@ -146,6 +147,8 @@ class ContainerCollectionTest(BaseIntegrationTest):
...
@@ -146,6 +147,8 @@ class ContainerCollectionTest(BaseIntegrationTest):
assert
logs
[
1
]
==
b
'world
\n
'
assert
logs
[
1
]
==
b
'world
\n
'
@pytest.mark.timeout
(
5
)
@pytest.mark.timeout
(
5
)
@pytest.mark.skipif
(
os
.
environ
.
get
(
'DOCKER_HOST'
,
''
)
.
startswith
(
'ssh://'
),
reason
=
'No cancellable streams over SSH'
)
def
test_run_with_streamed_logs_and_cancel
(
self
):
def
test_run_with_streamed_logs_and_cancel
(
self
):
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
client
=
docker
.
from_env
(
version
=
TEST_API_VERSION
)
out
=
client
.
containers
.
run
(
out
=
client
.
containers
.
run
(
...
...
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