def test_recovered_keys(session, recovery): """Testing that after recovery operation keys, which had to be recovered, are recovered and have correct data.""" for key in recovery["keys"]["recovered"]: for group in session.groups: result = session.read_data_from_groups(key, [group]).get()[0] assert_that(key, equal_to(get_sha1(result.data)), "The recovered data mismatch by sha1 hash")
def test_consistent_keys(session, recovery): """Testing that after recovery operation keys, which were availabe in all groups, are still available in all groups and have correct data.""" for key in recovery["keys"]["consistent"]: for group in session.groups: result = session.read_data_from_groups(key, [group]).get()[0] assert_that(key, equal_to(get_sha1(result.data)), "After recovering the data mismatch by sha1 hash")
def test_inconsistent_keys(session, recovery, dropped_groups): """Testing that after recovery operation keys, which were available in some specific groups, are still available in these groups and have correct data.""" available_groups = [group for group in session.groups if group not in dropped_groups] for key in recovery["keys"]["inconsistent"]: for group in available_groups: result = session.read_data_from_groups(key, [group]).get()[0] assert_that(key, equal_to(get_sha1(result.data)), "After recovering the data mismatch by sha1 hash")
def __init__(self, data): self.expected_sha1 = get_sha1(data)
def describe_mismatch(self, item, mismatch_description): mismatch_description.append_text(get_sha1(str(item)))
def _matches(self, item): result_sha1 = get_sha1(str(item)) return result_sha1 == self.expected_sha1