Remove time checks from test_custom_execute_timeout_* tests

Time checks were introduced in I058ff0a0e5ad517507dc3cda39087c913558561d
and adjusted in I3c2874855c2f061e93ecd088c516696366350833 commits. They
are still unstable on same environments. Let's disable these checks
until we'll have a better solution with a propper mocking.

Change-Id: Ia9054d7516909f68b89b647b743ca1d3ddef954e
This commit is contained in:
Ivan Kolodyazhny 2018-12-17 19:15:05 +02:00
parent 83f263ccf1
commit e40d94c69d

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import time
import mock import mock
from oslo_concurrency import processutils as putils from oslo_concurrency import processutils as putils
import six import six
@ -91,14 +89,11 @@ class PrivRootwrapTestCase(base.TestCase):
def test_custom_execute_timeout_raises_with_retries(self, sleep_mock): def test_custom_execute_timeout_raises_with_retries(self, sleep_mock):
on_execute = mock.Mock() on_execute = mock.Mock()
on_completion = mock.Mock() on_completion = mock.Mock()
t0 = time.time()
self.assertRaises(exception.ExecutionTimeout, self.assertRaises(exception.ExecutionTimeout,
priv_rootwrap.custom_execute, priv_rootwrap.custom_execute,
'sleep', '2', timeout=0.05, raise_timeout=True, 'sleep', '2', timeout=0.05, raise_timeout=True,
interval=2, backoff_rate=3, attempts=3, interval=2, backoff_rate=3, attempts=3,
on_execute=on_execute, on_completion=on_completion) on_execute=on_execute, on_completion=on_completion)
t1 = time.time()
self.assertLess(t1 - t0, 0.6)
sleep_mock.assert_has_calls([mock.call(0), mock.call(6), mock.call(0), sleep_mock.assert_has_calls([mock.call(0), mock.call(6), mock.call(0),
mock.call(18), mock.call(0)]) mock.call(18), mock.call(0)])
expected_calls = [mock.call(args[0][0]) expected_calls = [mock.call(args[0][0])
@ -107,13 +102,10 @@ class PrivRootwrapTestCase(base.TestCase):
on_completion.assert_has_calls(expected_calls) on_completion.assert_has_calls(expected_calls)
def test_custom_execute_timeout_no_raise(self): def test_custom_execute_timeout_no_raise(self):
t0 = time.time()
out, err = priv_rootwrap.custom_execute('sleep', '2', timeout=0.05, out, err = priv_rootwrap.custom_execute('sleep', '2', timeout=0.05,
raise_timeout=False) raise_timeout=False)
t1 = time.time()
self.assertEqual('', out) self.assertEqual('', out)
self.assertIsInstance(err, six.string_types) self.assertIsInstance(err, six.string_types)
self.assertLess(t1 - t0, 0.3)
def test_custom_execute_check_exit_code(self): def test_custom_execute_check_exit_code(self):
self.assertRaises(putils.ProcessExecutionError, self.assertRaises(putils.ProcessExecutionError,