From c33f2b49ddaa38e3faecb60a826fd9493d0eb09f Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Fri, 20 Jan 2017 19:41:15 +0000 Subject: [PATCH] Simplify get_different_suffix_df args Change-Id: I18a775c5b61c43c112f3658f9c27c7d4149ebbef Related-Change: I3a661fae5c7cfeb2dbcdb7f46941f55244d0b9ad --- test/unit/obj/test_diskfile.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/unit/obj/test_diskfile.py b/test/unit/obj/test_diskfile.py index 8fd67edaff..4de87fe5cf 100644 --- a/test/unit/obj/test_diskfile.py +++ b/test/unit/obj/test_diskfile.py @@ -5699,15 +5699,17 @@ class TestSuffixHashes(unittest.TestCase): with self.policy_in_message(): unittest.TestCase.assertEqual(self, *args) - def get_different_suffix_df(self, df, df_mgr, device, partition, - account, container, **kwargs): + def get_different_suffix_df(self, df): # returns diskfile in the same partition with different suffix suffix_dir = os.path.dirname(df._datadir) - i = 0 - while True: - df2 = df_mgr.get_diskfile(device, partition, account, container, - 'o%d' % i, **kwargs) - i += 1 + for i in itertools.count(): + df2 = df._manager.get_diskfile( + df._device_path, + df._datadir.split('/')[-3], + df._account, + df._container, + 'o%d' % i, + policy=df.policy) suffix_dir2 = os.path.dirname(df2._datadir) if suffix_dir != suffix_dir2: return df2 @@ -6109,9 +6111,7 @@ class TestSuffixHashes(unittest.TestCase): # invalidate a different suffix hash in same partition but not in # existing hashes.pkl - df2 = self.get_different_suffix_df(df, df_mgr, - 'sda1', '0', 'a', 'c', - policy=policy) + df2 = self.get_different_suffix_df(df) df2.delete(self.ts()) suffix_dir2 = os.path.dirname(df2._datadir) suffix2 = os.path.basename(suffix_dir2)