summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/test/unit
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-01-27 09:25:57 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-01-27 09:25:57 -0500
commit8a95bb14d811f0e7fbb9f6504d1b66f78adfd877 (patch)
tree6d504b5fd16163b493a7bf897908f33e9e9adb75 /roles/lib_openshift/src/test/unit
parent8f2b3f132bc6cd03640c31c0c33cffb01f80138c (diff)
downloadopenshift-8a95bb14d811f0e7fbb9f6504d1b66f78adfd877.tar.gz
openshift-8a95bb14d811f0e7fbb9f6504d1b66f78adfd877.tar.bz2
openshift-8a95bb14d811f0e7fbb9f6504d1b66f78adfd877.tar.xz
openshift-8a95bb14d811f0e7fbb9f6504d1b66f78adfd877.zip
Adding fix for when the resource does not exist. Added test cases.
Diffstat (limited to 'roles/lib_openshift/src/test/unit')
-rwxr-xr-xroles/lib_openshift/src/test/unit/oc_scale.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/roles/lib_openshift/src/test/unit/oc_scale.py b/roles/lib_openshift/src/test/unit/oc_scale.py
index c523592de..d8d5a231f 100755
--- a/roles/lib_openshift/src/test/unit/oc_scale.py
+++ b/roles/lib_openshift/src/test/unit/oc_scale.py
@@ -119,6 +119,30 @@ class OCScaleTest(unittest.TestCase):
self.assertFalse(results['changed'])
self.assertEqual(results['result'][0], 3)
+ @mock.patch('oc_scale.OCScale.openshift_cmd')
+ def test_no_dc_scale(self, mock_openshift_cmd):
+ ''' Testing a get '''
+ params = {'name': 'not_there',
+ 'namespace': 'default',
+ 'replicas': 3,
+ 'state': 'present',
+ 'kind': 'dc',
+ 'kubeconfig': '/etc/origin/master/admin.kubeconfig',
+ 'debug': False}
+
+ mock_openshift_cmd.side_effect = [
+ {"cmd": '/usr/bin/oc -n default get dc not_there -o json',
+ 'results': [{}],
+ 'returncode': 1,
+ 'stderr': "Error from server: deploymentconfigs \"not_there\" not found\n",
+ 'stdout': ""},
+ ]
+
+ results = OCScale.run_ansible(params, False)
+
+ self.assertTrue(results['failed'])
+ self.assertEqual(results['msg']['returncode'], 1)
+
def tearDown(self):
'''TearDown method'''
pass