Change docker-cmd for recent paunch changes
paunch was changed to support podman, it breaks some arguments, and expectations in our tests. Let's fix that. Change-Id: I7127cc2edb9af785e0533e0a1e5f2608417390e7
This commit is contained in:
parent
64b57bfef7
commit
637e4260ca
@ -76,9 +76,9 @@ def main(argv=sys.argv):
|
||||
stdout, stderr, deploy_status_code = paunch.apply(
|
||||
cid,
|
||||
config,
|
||||
managed_by='docker-cmd',
|
||||
labels=labels,
|
||||
docker_cmd=DOCKER_CMD
|
||||
'docker-cmd',
|
||||
labels,
|
||||
DOCKER_CMD
|
||||
)
|
||||
|
||||
json.dump(build_response(
|
||||
|
@ -53,8 +53,8 @@ def main(argv=sys.argv):
|
||||
|
||||
paunch.cleanup(
|
||||
cmd_config_ids,
|
||||
managed_by='docker-cmd',
|
||||
docker_cmd=DOCKER_CMD
|
||||
'docker-cmd',
|
||||
DOCKER_CMD
|
||||
)
|
||||
|
||||
|
||||
|
@ -234,6 +234,8 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
{},
|
||||
# docker run web
|
||||
{'stderr': 'Creating web...'},
|
||||
# inspect
|
||||
{},
|
||||
# name lookup for exec web
|
||||
{'stdout': 'web'},
|
||||
# docker exec web
|
||||
@ -253,7 +255,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
'deploy_status_code': 0
|
||||
}, json.loads(stdout.decode('utf-8')))
|
||||
|
||||
state = list(self.json_from_files(self.test_state_path, 13))
|
||||
state = list(self.json_from_files(self.test_state_path, 14))
|
||||
self.check_basic_response(state)
|
||||
self.assert_args_and_labels([
|
||||
self.fake_tool_path,
|
||||
@ -308,6 +310,15 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
u'container_name=web',
|
||||
u'managed_by=docker-cmd',
|
||||
], state[10]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'inspect',
|
||||
'--type',
|
||||
'container',
|
||||
'--format',
|
||||
'exists',
|
||||
'web-ls'
|
||||
], state[11]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
u'ps',
|
||||
@ -318,14 +329,14 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
u'label=config_id=abc123',
|
||||
u'--format',
|
||||
u'{{.Names}}',
|
||||
], state[11]['args'])
|
||||
], state[12]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
u'exec',
|
||||
u'web',
|
||||
u'/bin/ls',
|
||||
u'-l'
|
||||
], state[12]['args'])
|
||||
], state[13]['args'])
|
||||
|
||||
def test_hook_exit_codes(self):
|
||||
|
||||
@ -337,6 +348,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
{},
|
||||
# ps for currently running containers
|
||||
{},
|
||||
{},
|
||||
{'stdout': 'web'},
|
||||
{
|
||||
'stdout': '',
|
||||
@ -354,7 +366,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
'deploy_status_code': 0
|
||||
}, json.loads(stdout.decode('utf-8')))
|
||||
|
||||
state = list(self.json_from_files(self.test_state_path, 5))
|
||||
state = list(self.json_from_files(self.test_state_path, 6))
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'ps',
|
||||
@ -386,6 +398,15 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
'--format',
|
||||
'{{.Names}} {{.Label "container_name"}}'
|
||||
], state[2]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'inspect',
|
||||
'--type',
|
||||
'container',
|
||||
'--format',
|
||||
'exists',
|
||||
'web-ls'
|
||||
], state[3]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'ps',
|
||||
@ -396,14 +417,14 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
'label=config_id=abc123',
|
||||
'--format',
|
||||
'{{.Names}}',
|
||||
], state[3]['args'])
|
||||
], state[4]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'exec',
|
||||
'web',
|
||||
'/bin/ls',
|
||||
'-l'
|
||||
], state[4]['args'])
|
||||
], state[5]['args'])
|
||||
|
||||
def test_hook_failed(self):
|
||||
|
||||
@ -431,6 +452,8 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
{},
|
||||
# docker run web
|
||||
{'stderr': 'Creating web...'},
|
||||
# inspect
|
||||
{},
|
||||
# name lookup for exec web
|
||||
{'stdout': 'web'},
|
||||
# docker exec web fails
|
||||
@ -452,7 +475,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
'deploy_status_code': 2
|
||||
}, json.loads(stdout.decode('utf-8')))
|
||||
|
||||
state = list(self.json_from_files(self.test_state_path, 13))
|
||||
state = list(self.json_from_files(self.test_state_path, 14))
|
||||
self.check_basic_response(state)
|
||||
self.assert_args_and_labels([
|
||||
self.fake_tool_path,
|
||||
@ -507,6 +530,15 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
u'container_name=web',
|
||||
u'managed_by=docker-cmd',
|
||||
], state[10]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'inspect',
|
||||
'--type',
|
||||
'container',
|
||||
'--format',
|
||||
'exists',
|
||||
'web-ls'
|
||||
], state[11]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
u'ps',
|
||||
@ -517,14 +549,14 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
u'label=config_id=abc123',
|
||||
u'--format',
|
||||
u'{{.Names}}',
|
||||
], state[11]['args'])
|
||||
], state[12]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
u'exec',
|
||||
u'web',
|
||||
u'/bin/ls',
|
||||
u'-l'
|
||||
], state[12]['args'])
|
||||
], state[13]['args'])
|
||||
|
||||
def test_hook_unique_names(self):
|
||||
self.env.update({
|
||||
@ -571,7 +603,7 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
|
||||
self.assertEqual(0, returncode, stderr)
|
||||
|
||||
state = list(self.json_from_files(self.test_state_path, 15))
|
||||
state = list(self.json_from_files(self.test_state_path, 17))
|
||||
dd = []
|
||||
for i in state:
|
||||
dd.append(i['args'])
|
||||
@ -651,6 +683,24 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
u'container_name=web',
|
||||
u'managed_by=docker-cmd',
|
||||
], state[12]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'inspect',
|
||||
'--type',
|
||||
'container',
|
||||
'--format',
|
||||
'exists',
|
||||
'web-ls'
|
||||
], state[13]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'inspect',
|
||||
'--type',
|
||||
'container',
|
||||
'--format',
|
||||
'exists',
|
||||
state[14]['args'][6]
|
||||
], state[14]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
u'ps',
|
||||
@ -661,14 +711,14 @@ class HookDockerCmdTest(common.RunScriptTest):
|
||||
u'label=config_id=abc123',
|
||||
u'--format',
|
||||
u'{{.Names}}',
|
||||
], state[13]['args'])
|
||||
], state[15]['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
u'exec',
|
||||
u'web-asdf1234',
|
||||
u'web',
|
||||
u'/bin/ls',
|
||||
u'-l'
|
||||
], state[14]['args'])
|
||||
], state[16]['args'])
|
||||
|
||||
def test_cleanup_deleted(self):
|
||||
self.env.update({
|
||||
|
Loading…
Reference in New Issue
Block a user