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
ac68a36a
Unverified
Kaydet (Commit)
ac68a36a
authored
Ara 19, 2017
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Ara 19, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1727 from mbelang/join-swarn-default-listen-address
Add join_swarm default listen address
üst
57364369
7fa2cb7b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
1 deletion
+50
-1
swarm.py
docker/api/swarm.py
+1
-1
fake_api.py
tests/unit/fake_api.py
+6
-0
swarm_test.py
tests/unit/swarm_test.py
+43
-0
No files found.
docker/api/swarm.py
Dosyayı görüntüle @
ac68a36a
...
...
@@ -164,7 +164,7 @@ class SwarmApiMixin(object):
return
self
.
_result
(
self
.
_get
(
url
),
True
)
@utils.minimum_version
(
'1.24'
)
def
join_swarm
(
self
,
remote_addrs
,
join_token
,
listen_addr
=
None
,
def
join_swarm
(
self
,
remote_addrs
,
join_token
,
listen_addr
=
'0.0.0.0:2377'
,
advertise_addr
=
None
):
"""
Make this Engine join a swarm that has already been created.
...
...
tests/unit/fake_api.py
Dosyayı görüntüle @
ac68a36a
...
...
@@ -437,6 +437,10 @@ def post_fake_update_node():
return
200
,
None
def
post_fake_join_swarm
():
return
200
,
None
def
get_fake_network_list
():
return
200
,
[{
"Name"
:
"bridge"
,
...
...
@@ -601,6 +605,8 @@ fake_responses = {
CURRENT_VERSION
,
prefix
,
FAKE_NODE_ID
),
'POST'
):
post_fake_update_node
,
(
'{1}/{0}/swarm/join'
.
format
(
CURRENT_VERSION
,
prefix
),
'POST'
):
post_fake_join_swarm
,
(
'{1}/{0}/networks'
.
format
(
CURRENT_VERSION
,
prefix
),
'GET'
):
get_fake_network_list
,
(
'{1}/{0}/networks/create'
.
format
(
CURRENT_VERSION
,
prefix
),
'POST'
):
...
...
tests/unit/swarm_test.py
Dosyayı görüntüle @
ac68a36a
...
...
@@ -30,3 +30,46 @@ class SwarmTest(BaseAPIClientTest):
self
.
assertEqual
(
args
[
1
][
'headers'
][
'Content-Type'
],
'application/json'
)
@requires_api_version
(
'1.24'
)
def
test_join_swarm
(
self
):
remote_addr
=
[
'1.2.3.4:2377'
]
listen_addr
=
'2.3.4.5:2377'
join_token
=
'A_BEAUTIFUL_JOIN_TOKEN'
data
=
{
'RemoteAddrs'
:
remote_addr
,
'ListenAddr'
:
listen_addr
,
'JoinToken'
:
join_token
}
self
.
client
.
join_swarm
(
remote_addrs
=
remote_addr
,
listen_addr
=
listen_addr
,
join_token
=
join_token
)
args
=
fake_request
.
call_args
assert
(
args
[
0
][
1
]
==
url_prefix
+
'swarm/join'
)
assert
(
json
.
loads
(
args
[
1
][
'data'
])
==
data
)
assert
(
args
[
1
][
'headers'
][
'Content-Type'
]
==
'application/json'
)
@requires_api_version
(
'1.24'
)
def
test_join_swarm_no_listen_address_takes_default
(
self
):
remote_addr
=
[
'1.2.3.4:2377'
]
join_token
=
'A_BEAUTIFUL_JOIN_TOKEN'
data
=
{
'RemoteAddrs'
:
remote_addr
,
'ListenAddr'
:
'0.0.0.0:2377'
,
'JoinToken'
:
join_token
}
self
.
client
.
join_swarm
(
remote_addrs
=
remote_addr
,
join_token
=
join_token
)
args
=
fake_request
.
call_args
assert
(
args
[
0
][
1
]
==
url_prefix
+
'swarm/join'
)
assert
(
json
.
loads
(
args
[
1
][
'data'
])
==
data
)
assert
(
args
[
1
][
'headers'
][
'Content-Type'
]
==
'application/json'
)
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