Skip to content

Commit 110c676

Browse files
committed
Add test for join on already joined swarm
Signed-off-by: Hannes Ljungberg <[email protected]>
1 parent c7b9cae commit 110c676

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/integration/models_swarm_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,15 @@ def test_init_update_leave(self):
3131
cm.value.response.status_code == 406 or
3232
cm.value.response.status_code == 503
3333
)
34+
35+
def test_join_on_already_joined_swarm(self):
36+
client = docker.from_env(version=TEST_API_VERSION)
37+
client.swarm.init()
38+
join_token = client.swarm.attrs['JoinTokens']['Manager']
39+
with pytest.raises(docker.errors.APIError) as cm:
40+
client.swarm.join(
41+
remote_addrs=['127.0.0.1'],
42+
join_token=join_token,
43+
)
44+
assert cm.value.response.status_code == 503
45+
assert 'This node is already part of a swarm.' in cm.value.explanation

0 commit comments

Comments
 (0)