Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.loader.git.tests.test_loader.TestGitLoader2::test_load_incremental
Failed

TEST RESULT

Run At
May 4 2022, 11:43 AM
Details
self = <swh.loader.git.tests.test_loader.TestGitLoader2 object at 0x7fc381f56ef0> mocker = <pytest_mock.plugin.MockerFixture object at 0x7fc37e8b7ac8> def test_load_incremental(self, mocker): statsd_report = mocker.patch("swh.core.statsd.statsd._report") snapshot_id = b"\x01" * 20 now = datetime.datetime.now(tz=datetime.timezone.utc) def ovgl(origin_url, allowed_statuses, require_snapshot, type): if origin_url == f"base://{self.repo_url}": return OriginVisit(origin=origin_url, visit=42, date=now, type="git") else: return None self.loader.storage.origin_visit_get_latest.side_effect = ovgl self.loader.storage.origin_visit_status_get_latest.return_value = ( OriginVisitStatus( origin=f"base://{self.repo_url}", visit=42, snapshot=snapshot_id, date=now, status="full", ) ) self.loader.storage.snapshot_get_branches.return_value = { "id": snapshot_id, "branches": { b"refs/heads/master": SNAPSHOT1.branches[b"refs/heads/master"] }, "next_branch": None, } res = self.loader.load() assert res == {"status": "eventful"} self.fetcher_cls.assert_called_once_with( credentials={}, lister_name="fake-lister", lister_instance_name="", origin=Origin(url=self.repo_url), ) self.fetcher.get_parent_origins.assert_called_once_with() # First tries the same origin assert self.loader.storage.origin_visit_get_latest.mock_calls == [ call( self.repo_url, allowed_statuses=None, require_snapshot=True, type=None, ), # As it does not already have a snapshot, fall back to the parent origin call( f"base://{self.repo_url}", allowed_statuses=None, require_snapshot=True, type=None, ), ] p = "swh.loader.git" assert [c for c in statsd_report.mock_calls if c[1][0].startswith(p)] == [ call(f"{p}.loader.incremental.from_parent_origin", "c", 1, None, 1), call( f"{p}.loader.ratio_ignored_refs", "h", 0.0, {"incremental": "from_parent_origin"}, 1, ), call( f"{p}.loader.ratio_known_refs", "h", 0.25, {"incremental": "from_parent_origin"}, 1, ), ] self.fetcher.reset_mock() self.fetcher_cls.reset_mock() self.loader.storage.reset_mock(return_value=True, side_effect=True) statsd_report.reset_mock() # Load again res = self.loader.load() > assert res == {"status": "uneventful"} E AssertionError: assert {'status': 'eventful'} == {'status': 'uneventful'} E Differing items: E {'status': 'eventful'} != {'status': 'uneventful'} E Full diff: E - {'status': 'uneventful'} E ? -- E + {'status': 'eventful'} .tox/py3/lib/python3.7/site-packages/swh/loader/git/tests/test_loader.py:288: AssertionError