diff options
Diffstat (limited to 'roles/lib_openshift/src')
-rw-r--r-- | roles/lib_openshift/src/doc/process | 12 | ||||
-rwxr-xr-x | roles/lib_openshift/src/test/unit/oc_process.py | 14 |
2 files changed, 20 insertions, 6 deletions
diff --git a/roles/lib_openshift/src/doc/process b/roles/lib_openshift/src/doc/process index 2322bf49c..86a854c07 100644 --- a/roles/lib_openshift/src/doc/process +++ b/roles/lib_openshift/src/doc/process @@ -10,7 +10,11 @@ description: options: state: description: - - Currently present is only supported state. + - State has a few different meanings when it comes to process. + - state: present - This state runs an `oc process <template>`. When used in + - conjunction with 'create: True' the process will be piped to | oc create -f + - state: absent - will remove a template + - state: list - will perform an `oc get template <template_name>` default: present choices: ["present", "absent", "list"] aliases: [] @@ -52,9 +56,9 @@ options: aliases: [] create: description: - - Whether or not to create the template after being processed. e.q oc process | oc create -f - - required: false - default: None + - Whether or not to create the template after being processed. e.g. oc process | oc create -f - + required: False + default: False aliases: [] reconcile: description: diff --git a/roles/lib_openshift/src/test/unit/oc_process.py b/roles/lib_openshift/src/test/unit/oc_process.py index c0cf625cc..450ff7071 100755 --- a/roles/lib_openshift/src/test/unit/oc_process.py +++ b/roles/lib_openshift/src/test/unit/oc_process.py @@ -257,8 +257,9 @@ class OCProcessTest(unittest.TestCase): ''' setup method will set to known configuration ''' pass + @mock.patch('oc_process.Utils.create_tmpfile_copy') @mock.patch('oc_process.OCProcess._run') - def test_state_list(self, mock_cmd): + def test_state_list(self, mock_cmd, mock_tmpfile_copy): ''' Testing a get ''' params = {'template_name': 'mysql-ephermeral', 'namespace': 'test', @@ -274,13 +275,18 @@ class OCProcessTest(unittest.TestCase): (0, OCProcessTest.mysql, '') ] + mock_tmpfile_copy.side_effect = [ + '/tmp/mock_kubeconfig', + ] + results = OCProcess.run_ansible(params, False) self.assertFalse(results['changed']) self.assertEqual(results['results']['results'][0]['metadata']['name'], 'mysql-ephemeral') + @mock.patch('oc_process.Utils.create_tmpfile_copy') @mock.patch('oc_process.OCProcess._run') - def test_process_no_create(self, mock_cmd): + def test_process_no_create(self, mock_cmd, mock_tmpfile_copy): ''' Testing a process with no create ''' params = {'template_name': 'mysql-ephermeral', 'namespace': 'test', @@ -459,6 +465,10 @@ class OCProcessTest(unittest.TestCase): (0, mysqlproc, ''), ] + mock_tmpfile_copy.side_effect = [ + '/tmp/mock_kubeconfig', + ] + results = OCProcess.run_ansible(params, False) self.assertFalse(results['changed']) |