MCPcopy Index your code
hub / github.com/docker/docker-py / test_init_update_leave

Method test_init_update_leave

tests/integration/models_swarm_test.py:18–34  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 5

from_envMethod · 0.80
initMethod · 0.80
leaveMethod · 0.80
updateMethod · 0.45
reloadMethod · 0.45

Tested by

no test coverage detected