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

Method test_restart

tests/integration/api_container_test.py:1172–1189  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1170
1171class RestartContainerTest(BaseAPIIntegrationTest):
1172 def test_restart(self):
1173 container = self.client.create_container(TEST_IMG, ['sleep', '9999'])
1174 id = container['Id']
1175 self.client.start(id)
1176 self.tmp_containers.append(id)
1177 info = self.client.inspect_container(id)
1178 assert 'State' in info
1179 assert 'StartedAt' in info['State']
1180 start_time1 = info['State']['StartedAt']
1181 self.client.restart(id, timeout=2)
1182 info2 = self.client.inspect_container(id)
1183 assert 'State' in info2
1184 assert 'StartedAt' in info2['State']
1185 start_time2 = info2['State']['StartedAt']
1186 assert start_time1 != start_time2
1187 assert 'Running' in info2['State']
1188 assert info2['State']['Running'] is True
1189 self.client.kill(id)
1190
1191 def test_restart_with_low_timeout(self):
1192 container = self.client.create_container(TEST_IMG, ['sleep', '9999'])

Callers

nothing calls this directly

Calls 5

create_containerMethod · 0.80
inspect_containerMethod · 0.80
startMethod · 0.45
restartMethod · 0.45
killMethod · 0.45

Tested by

no test coverage detected