From 935996d152a87a2b27d2b43f85f3bca710a4e555 Mon Sep 17 00:00:00 2001 From: Shubhendu Tripathi Date: Mon, 14 Apr 2014 14:17:08 +0530 Subject: gluster-nagios-common: Fixed test failure for gluster Fixed the test failure because of gluster command Change-Id: Ica6cd01c17e6bc9a9951bfe2c488eb6a359af447 Signed-off-by: Shubhendu Tripathi --- tests/test_storage.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test_storage.py b/tests/test_storage.py index 33c1389..f080430 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -280,6 +280,7 @@ class TestStorageUtils(TestCaseBase): 'LVM2_PV_PE_COUNT': '12674'}} self.assertEquals(ret_val, value_to_verify) + @mock.patch('glusternagios.storage._getBrickMountPoints') @mock.patch('glusternagios.storage._getMountPoint') @mock.patch('glusternagios.storage._getProcMounts') @mock.patch('glusternagios.storage.glustercli.utils') @@ -288,7 +289,8 @@ class TestStorageUtils(TestCaseBase): mock_get_lv_details, mock_utils, mock_proc_mounts, - mock_get_mount_point): + mock_get_mount_point, + mock_get_brick_mount_points): mock_get_lv_details.return_value = {'lv_root': {'LVM2_LV_NAME': 'lv_root', 'LVM2_PV_NAME': '/dev/vda2', @@ -333,16 +335,19 @@ class TestStorageUtils(TestCaseBase): '/proc/bus/usb': '/proc/bus/usb', 'proc': '/proc'} mock_get_mount_point.return_value = "/" + mock_get_brick_mount_points.return_value = {'server-1:/tmp/vol1-a': "/"} bricks = glusternagios.storage.getBricksForDisk("/dev/vda2") self.assertEquals(bricks, ['server-1:/tmp/vol1-a']) + @mock.patch('glusternagios.storage._getBrickDeviceName') @mock.patch('glusternagios.storage._getLvDetails') @mock.patch('glusternagios.storage.glustercli.utils') @mock.patch('glusternagios.storage._getMountPoint') def testGetDisksForBrick(self, mock_get_mount_point, mock_utils, - mock_get_lv_details): + mock_get_lv_details, + mock_get_brick_device_name): mock_get_mount_point.return_value = "/" tmp_out = ['', '', @@ -383,6 +388,8 @@ class TestStorageUtils(TestCaseBase): disk = glusternagios.storage.getDisksForBrick("server-1:" "/tmp/vol1-a") self.assertEquals(disk, "/dev/vda2") + mock_get_brick_device_name.return_value = "/dev/mapper/" \ + "vg_shubhnd-lv_root" disk = glusternagios.storage.getDisksForBrick("server-1:/tmp/vol1-a", "/dev/mapper/" -- cgit