summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2017-12-29 09:19:41 +0000
committerGerrit Code Review <review@openstack.org>2017-12-29 09:19:41 +0000
commit421b9711692b29424d23c59ab4cfad56d18462c7 (patch)
tree4a5f7329438b94e3e467db258f6a220e876539d3
parent756fcafdf025351ea862ae57f29b8eff9beee362 (diff)
parent62c4511eeb3b99775ce87b667233d7c5926dbffa (diff)
Merge "Make chef agent tests more reliable"
-rw-r--r--tests/test_hook_chef.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/test_hook_chef.py b/tests/test_hook_chef.py
index 05968dc..2fd9c87 100644
--- a/tests/test_hook_chef.py
+++ b/tests/test_hook_chef.py
@@ -96,8 +96,6 @@ class HookChefTest(common.RunScriptTest):
96 'fooval': {u'bar': u'baz'}, 96 'fooval': {u'bar': u'baz'},
97 'run_list': [u'recipe[apache]'] 97 'run_list': [u'recipe[apache]']
98 } 98 }
99 exp_node = json.dumps(exp_node, indent=4,
100 separators=(',', ': '))
101 exp_cfg = ("log_level :debug\n" 99 exp_cfg = ("log_level :debug\n"
102 "log_location STDOUT\n" 100 "log_location STDOUT\n"
103 "local_mode true\n" 101 "local_mode true\n"
@@ -111,7 +109,8 @@ class HookChefTest(common.RunScriptTest):
111 "node_path '/var/lib/heat-config/" 109 "node_path '/var/lib/heat-config/"
112 "heat-config-chef/node'") 110 "heat-config-chef/node'")
113 mfdopen.return_value.write.assert_any_call(exp_cfg) 111 mfdopen.return_value.write.assert_any_call(exp_cfg)
114 mfdopen.return_value.write.assert_any_call(exp_node) 112 args = mfdopen.return_value.write.mock_calls[0][1][0]
113 self.assertEqual(exp_node, json.loads(args))
115 calls = [ 114 calls = [
116 mock.call(['hostname', '-f'], env=mock.ANY, stderr=mock.ANY, 115 mock.call(['hostname', '-f'], env=mock.ANY, stderr=mock.ANY,
117 stdout=mock.ANY), 116 stdout=mock.ANY),
@@ -194,8 +193,6 @@ class HookChefTest(common.RunScriptTest):
194 'fooval': {u'bar': u'baz'}, 193 'fooval': {u'bar': u'baz'},
195 'run_list': [u'recipe[apache]'] 194 'run_list': [u'recipe[apache]']
196 } 195 }
197 exp_node = json.dumps(exp_node, indent=4,
198 separators=(',', ': '))
199 exp_cfg = ("log_level :debug\n" 196 exp_cfg = ("log_level :debug\n"
200 "log_location STDOUT\n" 197 "log_location STDOUT\n"
201 "local_mode true\n" 198 "local_mode true\n"
@@ -210,4 +207,5 @@ class HookChefTest(common.RunScriptTest):
210 "node_path '/var/lib/heat-config/" 207 "node_path '/var/lib/heat-config/"
211 "heat-config-chef/node'") 208 "heat-config-chef/node'")
212 mfdopen.return_value.write.assert_any_call(exp_cfg) 209 mfdopen.return_value.write.assert_any_call(exp_cfg)
213 mfdopen.return_value.write.assert_any_call(exp_node) 210 args = mfdopen.return_value.write.mock_calls[0][1][0]
211 self.assertEqual(exp_node, json.loads(args))