summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-03-13 22:08:06 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-08-11 21:09:17 -0700
commitc2f99db8b4d8f021b29a4e3aae483ba715936a66 (patch)
treece5cbf8443c14d1078aef5ae870235c7f706d0ad /tests/unit/benchmark
parentae6f51c15a61e345cdc609f372ad04859d2e999d (diff)
Add Ansible executor class for node context
import the AnsibleCommon class to execute Ansible playbooks Update node context support to use AnsibleCommon needs unittests We must call ansible-playbook as an executable, so we must create temp files for inventory, and for the playbooks. AnsibleCommon has evolved to be quite flexible, it auto-generates the inventory from the context['nodes'] and generates groups from the node Role. We also support either a single playbook filename, or a list of filenames. If given a list we dynamically generate a playbook that includes the other playbooks. We support adding any number of extra_vars using a temp JSON file. Also designed to be extended by subclassing. Change-Id: I5bd0a2b4547feaadd70b7e2b8801f19371b99df0 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r--tests/unit/benchmark/contexts/test_node.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/unit/benchmark/contexts/test_node.py b/tests/unit/benchmark/contexts/test_node.py
index 9b5761c8d..a2e2f7b9a 100644
--- a/tests/unit/benchmark/contexts/test_node.py
+++ b/tests/unit/benchmark/contexts/test_node.py
@@ -131,10 +131,8 @@ class NodeContextTestCase(unittest.TestCase):
self.test_context.env = {}
self.assertEqual(self.test_context._dispatch_ansible('ansible'), None)
- @mock.patch("{}.subprocess".format(PREFIX))
- def test__do_ansible_job(self, mock_subprocess):
- mock_subprocess.Popen = mock.MagicMock()
- mock_subprocess.communicate = mock.Mock()
+ @mock.patch("{}.AnsibleCommon".format(PREFIX))
+ def test__do_ansible_job(self, mock_ansible):
self.assertEqual(None, self.test_context._do_ansible_job('dummy'))
def test_successful_init(self):