def test_key_for_removal(self): ws = WorkloadSettings(items=10 ** 3, workers=20, working_set=100, working_set_access=100, working_set_moving_docs=0, key_fmtr='decimal') keys = set() for worker in range(ws.workers): for key in docgen.SequentialKey(sid=worker, ws=ws, prefix='test'): keys.add(key.string) key_gen = docgen.KeyForRemoval(prefix='test', fmtr='decimal') for op in range(1, 100): key = key_gen.next(op) self.assertIn(key.string, keys)
def test_key_for_removal(self): ws = WorkloadSettings(items=10**3, workers=20, working_set=100, working_set_access=100, working_set_moving_docs=0) keys = set() for worker in range(ws.workers): for key in docgen.UnorderedKey(sid=worker, ws=ws, prefix='test'): keys.add(key) key_gen = docgen.KeyForRemoval(prefix='test') for op in range(1, 100): key = key_gen.next(op) self.assertIn(key, keys)
def test_working_set_deletes(self): ws = WorkloadSettings(items=10 ** 3, workers=40, working_set=20, working_set_access=50, working_set_moving_docs=0, key_fmtr='hex') keys_for_removal = docgen.KeyForRemoval(prefix='test', fmtr=ws.key_fmtr) removed_keys = set() for i in range(100): key = keys_for_removal.next(i) removed_keys.add(key.string) removed_keys = sorted(removed_keys) wsk = docgen.WorkingSetKey(ws=ws, prefix='test') for op in range(10 ** 5): key = wsk.next(curr_items=ws.items + 100, curr_deletes=100) self.assertNotIn(key.string, removed_keys)