Do docker operations in a defined order
This fixes the heat-templates gate Change-Id: If171d93408e9252606454ce61e5923502649d2bc
This commit is contained in:
parent
67e02ce57c
commit
8ab13c5489
@ -84,7 +84,7 @@ def main(argv=sys.argv):
|
||||
if not isinstance(config, dict):
|
||||
config = yaml.safe_load(config)
|
||||
|
||||
for container in config:
|
||||
for container in sorted(config):
|
||||
container_name = '%s__%s' % (c['name'], container)
|
||||
cmd = [
|
||||
DOCKER_CMD,
|
||||
|
@ -113,7 +113,7 @@ def delete_missing_projects(configs):
|
||||
def extract_container_names(proj, proj_data):
|
||||
# For now, assume a docker-compose v1 format where the
|
||||
# root keys are service names
|
||||
for name in proj_data:
|
||||
for name in sorted(proj_data):
|
||||
yield '%s__%s' % (proj, name)
|
||||
|
||||
|
||||
|
@ -102,14 +102,6 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||
|
||||
state_0 = self.json_from_file(self.test_state_path)
|
||||
state_1 = self.json_from_file('%s_1' % self.test_state_path)
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'run',
|
||||
'--detach=true',
|
||||
'--name',
|
||||
'abcdef001__web',
|
||||
'xxx'
|
||||
], state_0['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'run',
|
||||
@ -125,6 +117,14 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||
'--volume=/run:/run',
|
||||
'--volume=db:/var/lib/db',
|
||||
'xxx'
|
||||
], state_0['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'run',
|
||||
'--detach=true',
|
||||
'--name',
|
||||
'abcdef001__web',
|
||||
'xxx'
|
||||
], state_1['args'])
|
||||
|
||||
def test_hook_failed(self):
|
||||
@ -148,14 +148,6 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||
|
||||
state_0 = self.json_from_file(self.test_state_path)
|
||||
state_1 = self.json_from_file('%s_1' % self.test_state_path)
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'run',
|
||||
'--detach=true',
|
||||
'--name',
|
||||
'abcdef001__web',
|
||||
'xxx'
|
||||
], state_0['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'run',
|
||||
@ -171,6 +163,14 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||
'--volume=/run:/run',
|
||||
'--volume=db:/var/lib/db',
|
||||
'xxx'
|
||||
], state_0['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'run',
|
||||
'--detach=true',
|
||||
'--name',
|
||||
'abcdef001__web',
|
||||
'xxx'
|
||||
], state_1['args'])
|
||||
|
||||
def test_cleanup_deleted(self):
|
||||
@ -210,13 +210,13 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||
self.fake_tool_path,
|
||||
'rm',
|
||||
'-f',
|
||||
'abcdef001__web',
|
||||
'abcdef001__db',
|
||||
], state_0['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'rm',
|
||||
'-f',
|
||||
'abcdef001__db',
|
||||
'abcdef001__web',
|
||||
], state_1['args'])
|
||||
|
||||
def test_cleanup_changed(self):
|
||||
@ -257,11 +257,11 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||
self.fake_tool_path,
|
||||
'rm',
|
||||
'-f',
|
||||
'abcdef001__web',
|
||||
'abcdef001__db',
|
||||
], state_0['args'])
|
||||
self.assertEqual([
|
||||
self.fake_tool_path,
|
||||
'rm',
|
||||
'-f',
|
||||
'abcdef001__db',
|
||||
'abcdef001__web',
|
||||
], state_1['args'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user