summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2019-03-31 23:10:23 +0200
committerHannes Ljungberg <hannes@5monkeys.se>2019-05-01 10:24:50 +0200
commit110c6769c93cd9c8bf20cc88c520a9f97afc040e (patch)
tree618414d6f09c0517c0586d9ff5219e24cc6c8cb3
parentc7b9cae0a0430ec9e9ce95bb872755dfe61d4f87 (diff)
downloaddocker-py-110c6769c93cd9c8bf20cc88c520a9f97afc040e.tar.gz
Add test for join on already joined swarm
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
-rw-r--r--tests/integration/models_swarm_test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/integration/models_swarm_test.py b/tests/integration/models_swarm_test.py
index f39f0d3..6c1836d 100644
--- a/tests/integration/models_swarm_test.py
+++ b/tests/integration/models_swarm_test.py
@@ -31,3 +31,15 @@ class SwarmTest(unittest.TestCase):
cm.value.response.status_code == 406 or
cm.value.response.status_code == 503
)
+
+ def test_join_on_already_joined_swarm(self):
+ client = docker.from_env(version=TEST_API_VERSION)
+ client.swarm.init()
+ join_token = client.swarm.attrs['JoinTokens']['Manager']
+ with pytest.raises(docker.errors.APIError) as cm:
+ client.swarm.join(
+ remote_addrs=['127.0.0.1'],
+ join_token=join_token,
+ )
+ assert cm.value.response.status_code == 503
+ assert 'This node is already part of a swarm.' in cm.value.explanation