From 4cda711a04eafa13a1378ea3e684b2951ebe3c32 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Fri, 13 Feb 2015 11:56:48 -0500 Subject: [PATCH] Tests: Remove randomness from NFS mount tests No real reason for this to be randomized... just set the number of attempts to 3 for simplicity / reproducibility. Change-Id: I0f11a157359f8905105194059c1ea68ce9f1860c --- cinder/tests/test_nfs.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cinder/tests/test_nfs.py b/cinder/tests/test_nfs.py index 91886eafd..40d950f9f 100644 --- a/cinder/tests/test_nfs.py +++ b/cinder/tests/test_nfs.py @@ -16,7 +16,6 @@ import errno import os -import random import mock import mox as mox_lib @@ -1082,10 +1081,9 @@ class NfsDriverTestCase(test.TestCase): def test_ensure_share_mounted(self): """Case where the mount works the first time.""" - num_attempts = random.randint(1, 5) self.mock_object(self._driver._remotefsclient, 'mount') drv = self._driver - drv.configuration.nfs_mount_attempts = num_attempts + drv.configuration.nfs_mount_attempts = 3 drv.shares = {self.TEST_NFS_EXPORT1: ''} drv._ensure_share_mounted(self.TEST_NFS_EXPORT1) @@ -1095,7 +1093,8 @@ class NfsDriverTestCase(test.TestCase): def test_ensure_share_mounted_exception(self): """Make the configured number of attempts when mounts fail.""" - num_attempts = random.randint(1, 5) + num_attempts = 3 + self.mock_object(self._driver._remotefsclient, 'mount', mock.Mock(side_effect=Exception)) drv = self._driver -- 2.45.2