-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
landing_worker: fix handling of merge conflicts (bug 1938162) (bug 19…
…35549) (#182) test_landings: add test for merge conflicts (bug 1935549) landing_worker: don't double-decode reject paths (bug 1938162) scm: fix reject_path interface (bug 1938162) landing_worker: remove content from base error_breakdown for conflicts abstract_scm: rename reject_paths to (get_)rejects_paths landing_worker: better naming in process_merge_conflict
- Loading branch information
Showing
7 changed files
with
98 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -456,6 +456,69 @@ def test_lose_push_race( | |
assert job.status == LandingJobStatus.DEFERRED | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_merge_conflict( | ||
hg_server, | ||
hg_clone, | ||
treestatusdouble, | ||
monkeypatch, | ||
create_patch_revision, | ||
normal_patch, | ||
caplog, | ||
): | ||
treestatusdouble.open_tree("mozilla-central") | ||
repo = Repo.objects.create( | ||
scm_type=SCM_TYPE_HG, | ||
name="mozilla-central", | ||
url=hg_server, | ||
required_permission=SCM_LEVEL_3, | ||
push_path=hg_server, | ||
pull_path=hg_server, | ||
system_path=hg_clone.strpath, | ||
) | ||
job_params = { | ||
"id": 1234, | ||
"status": LandingJobStatus.IN_PROGRESS, | ||
"requester_email": "[email protected]", | ||
"target_repo": repo, | ||
"attempts": 1, | ||
} | ||
job = add_job_with_revisions( | ||
[ | ||
create_patch_revision(1, patch=PATCH_FORMATTED_2), | ||
], | ||
**job_params, | ||
) | ||
|
||
worker = LandingWorker(repos=Repo.objects.all(), sleep_seconds=0.01) | ||
|
||
# We don't care about repo update in this test, however if we don't mock | ||
# this, the test will fail since there is no celery instance. | ||
monkeypatch.setattr( | ||
"lando.api.legacy.workers.landing_worker.LandingWorker.phab_trigger_repo_update", | ||
mock.MagicMock(), | ||
) | ||
|
||
assert worker.run_job(job) | ||
assert job.status == LandingJobStatus.FAILED | ||
assert "hunks FAILED" in caplog.text | ||
assert job.error_breakdown, "No error breakdown added to job" | ||
assert job.error_breakdown.get( | ||
"rejects_paths" | ||
), "Empty or missing reject information in error breakdown" | ||
failed_paths = [p["path"] for p in job.error_breakdown["failed_paths"]] | ||
assert set(failed_paths) == set( | ||
job.error_breakdown["rejects_paths"].keys() | ||
), "Mismatch between failed_paths and rejects_paths" | ||
for fp in failed_paths: | ||
assert job.error_breakdown["rejects_paths"][fp].get( | ||
"path" | ||
), f"Empty or missing reject path for failed path {fp}" | ||
assert job.error_breakdown["rejects_paths"][fp].get( | ||
"content" | ||
), f"Empty or missing reject content for failed path {fp}" | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_failed_landing_job_notification( | ||
hg_server, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters