From ffdc9f4ea59131de97f8c41784ee6c79d654662f Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Fri, 24 May 2019 17:58:01 +0530 Subject: Use 'cmd_run' func instead of 'g.run' func in openshift_ops.py It will allow us to recreate SSH connections when it is broken. Also, do following additional things: - Fix 'podcmd' module, where 'user' argument for 'g.run' is missing in it's wrapper. - Use "g.log.error" command to log errors when they appear inside of the 'cmd_run' func. - Delete several unused commands, instead of fixing them. - Update several test cases's logic due to the changes in the libraries. Change-Id: I908e5adcff739b6ab3a4aefaebfe46abdee22655 --- tests/functional/provisioning/test_pv_resize.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/functional/provisioning') diff --git a/tests/functional/provisioning/test_pv_resize.py b/tests/functional/provisioning/test_pv_resize.py index a5b9d2c2..288355dd 100644 --- a/tests/functional/provisioning/test_pv_resize.py +++ b/tests/functional/provisioning/test_pv_resize.py @@ -78,9 +78,13 @@ class TestPvResizeClass(BaseClass): cmd, node)) cmd = ("dd if=/dev/urandom of=%sfile2 " "bs=100K count=10000") % dir_path - ret, out, err = oc_rsh(node, pod_name, cmd) - self.assertNotEqual(ret, 0, " This IO did not fail as expected " - "command %s on %s" % (cmd, node)) + with self.assertRaises(AssertionError): + ret, out, err = oc_rsh(node, pod_name, cmd) + msg = ("Command '%s' was expected to fail on '%s' node. " + "But it returned following: ret is '%s', err is '%s' " + "and out is '%s'" % (cmd, node, ret, err, out)) + raise ExecutionError(msg) + pvc_size = 2 resize_pvc(node, pvc_name, pvc_size) verify_pvc_size(node, pvc_name, pvc_size) @@ -224,7 +228,7 @@ class TestPvResizeClass(BaseClass): self.assertEqual(ret, 0, "failed to execute command %s on %s" % ( cmd, node)) pvc_resize = 2 - with self.assertRaises(ExecutionError): + with self.assertRaises(AssertionError): resize_pvc(node, pvc_name, pvc_resize) verify_pvc_size(node, pvc_name, pv_size) pv_name = get_pv_name_from_pvc(node, pvc_name) -- cgit