Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.storage.tests.test_cassandra.TestCassandraStorage::test_generate_content_get_partition_pagination
Failed

TEST RESULT

Run At
Aug 5 2020, 4:34 PM
Details
self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f59841caf28> swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f596878e9b0> swh_contents = [Content(sha1=b'\xa5M\xf7\x81Ft\xb8|\x9cqU8?6\xb9\xfc>7Y\x06', sha1_git=b']\xba\xab\xce\xb4*\xc3\xc5&<\xff\x92\xb7\xf2...e=datetime.datetime(2056, 1, 28, 3, 53, 17, 599858, tzinfo=<DstTzInfo 'America/Sitka' AKST-1 day, 15:00:00 STD>)), ...] def test_generate_content_get_partition_pagination(self, swh_storage, swh_contents): """content_get_partition returns contents within range provided""" expected_contents = [ attr.evolve(c, data=None) for c in swh_contents if c.status != "absent" ] # retrieve contents actual_contents = [] for i in range(4): page_token = None while True: actual_result = swh_storage.content_get_partition( > i, 4, limit=3, page_token=page_token ) .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:617: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f596878e9b0> partition_id = 2, nb_partitions = 4, page_token = None, limit = 3 def content_get_partition( self, partition_id: int, nb_partitions: int, page_token: Optional[str] = None, limit: int = 1000, ) -> PagedResult[Content]: if limit is None: raise StorageArgumentException("limit should not be None") # Compute start and end of the range of tokens covered by the # requested partition partition_size = (TOKEN_END - TOKEN_BEGIN) // nb_partitions range_start = TOKEN_BEGIN + partition_id * partition_size range_end = TOKEN_BEGIN + (partition_id + 1) * partition_size # offset the range start according to the `page_token`. if page_token is not None: if not (range_start <= int(page_token) <= range_end): raise StorageArgumentException("Invalid page_token.") range_start = int(page_token) next_page_token: Optional[str] = None rows = self._cql_runner.content_get_token_range( range_start, range_end, limit + 1 ) contents = [] for counter, row in enumerate(rows): if row.status == "absent": continue row_d = row._asdict() last_id = row_d.pop("tok") if counter > limit: next_page_token = last_id break contents.append(Content(**row_d)) > assert len(contents) <= limit E AssertionError: assert 4 <= 3 E + where 4 = len([Content(sha1=b'\xa3\xb2W\xda\x1e]\x0eT;\xddk\x07\xbd\x11\xa7M\xfb\xdb\xab\xb3', sha1_git=b'\xba\xe8\xb8\x14\x00\x83:\...3\xe4\xc4\x80&=Ai', length=6529, status='visible', data=None, ctime=datetime.datetime(2020, 8, 5, 14, 31, 45, 523000))]) .tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:214: AssertionError