Simplify get_different_suffix_df args

Change-Id: I18a775c5b61c43c112f3658f9c27c7d4149ebbef
Related-Change: I3a661fae5c7cfeb2dbcdb7f46941f55244d0b9ad
This commit is contained in:
Tim Burke
2017-01-20 19:41:15 +00:00
parent e772cf95c6
commit c33f2b49dd

View File

@@ -5699,15 +5699,17 @@ class TestSuffixHashes(unittest.TestCase):
with self.policy_in_message(): with self.policy_in_message():
unittest.TestCase.assertEqual(self, *args) unittest.TestCase.assertEqual(self, *args)
def get_different_suffix_df(self, df, df_mgr, device, partition, def get_different_suffix_df(self, df):
account, container, **kwargs):
# returns diskfile in the same partition with different suffix # returns diskfile in the same partition with different suffix
suffix_dir = os.path.dirname(df._datadir) suffix_dir = os.path.dirname(df._datadir)
i = 0 for i in itertools.count():
while True: df2 = df._manager.get_diskfile(
df2 = df_mgr.get_diskfile(device, partition, account, container, df._device_path,
'o%d' % i, **kwargs) df._datadir.split('/')[-3],
i += 1 df._account,
df._container,
'o%d' % i,
policy=df.policy)
suffix_dir2 = os.path.dirname(df2._datadir) suffix_dir2 = os.path.dirname(df2._datadir)
if suffix_dir != suffix_dir2: if suffix_dir != suffix_dir2:
return df2 return df2
@@ -6109,9 +6111,7 @@ class TestSuffixHashes(unittest.TestCase):
# invalidate a different suffix hash in same partition but not in # invalidate a different suffix hash in same partition but not in
# existing hashes.pkl # existing hashes.pkl
df2 = self.get_different_suffix_df(df, df_mgr, df2 = self.get_different_suffix_df(df)
'sda1', '0', 'a', 'c',
policy=policy)
df2.delete(self.ts()) df2.delete(self.ts())
suffix_dir2 = os.path.dirname(df2._datadir) suffix_dir2 = os.path.dirname(df2._datadir)
suffix2 = os.path.basename(suffix_dir2) suffix2 = os.path.basename(suffix_dir2)