| 16 | helpers.force_leave_swarm(docker.from_env(version=TEST_API_VERSION)) |
| 17 | |
| 18 | def test_init_update_leave(self): |
| 19 | client = docker.from_env(version=TEST_API_VERSION) |
| 20 | client.swarm.init( |
| 21 | advertise_addr='127.0.0.1', snapshot_interval=5000, |
| 22 | listen_addr=helpers.swarm_listen_addr() |
| 23 | ) |
| 24 | assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 5000 |
| 25 | client.swarm.update(snapshot_interval=10000) |
| 26 | assert client.swarm.attrs['Spec']['Raft']['SnapshotInterval'] == 10000 |
| 27 | assert client.swarm.id |
| 28 | assert client.swarm.leave(force=True) |
| 29 | with pytest.raises(docker.errors.APIError) as cm: |
| 30 | client.swarm.reload() |
| 31 | assert ( |
| 32 | cm.value.response.status_code == 406 or |
| 33 | cm.value.response.status_code == 503 |
| 34 | ) |
| 35 | |
| 36 | def test_join_on_already_joined_swarm(self): |
| 37 | client = docker.from_env(version=TEST_API_VERSION) |