Skip to content

Issue #668 - Changes for using json-automationrelevance instead of json-rev #927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 30, 2021
Merged
7 changes: 5 additions & 2 deletions backend/code_coverage_backend/hgmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

__hgmo: Dict[str, Tuple[int, float]] = {}

HGMO_REVISION_URL = "https://hg.mozilla.org/{repository}/json-rev/{revision}"
HGMO_REVISION_URL = (
"https://hg.mozilla.org/{repository}/json-automationrelevance/{revision}"
)
HGMO_PUSHES_URL = "https://hg.mozilla.org/{repository}/json-pushes"


Expand All @@ -29,7 +31,8 @@ def hgmo_revision_details(repository, changeset):
url = HGMO_REVISION_URL.format(repository=repository, revision=changeset)
resp = requests.get(url)
resp.raise_for_status()
data = resp.json()
assert "changesets" in resp.json(), "Missing changesets"
data = resp.json()["changesets"][-1]
assert "pushid" in data, "Missing pushid"
out = data["pushid"], data["date"][0]

Expand Down
6 changes: 3 additions & 3 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def mock_hgmo():

def _test_rev(request):
# The push id is in the first 3 characters of the revision requested
revision = request.path_url[17:]
revision = request.path_url[33:]
assert len(revision) == 32
resp = {"pushid": int(revision[:3]), "date": [time.time(), 0]}
resp = {"changesets": [{"pushid": int(revision[:3]), "date": [time.time(), 0]}]}
return (200, headers, json.dumps(resp))

def _changesets(push_id):
Expand Down Expand Up @@ -185,7 +185,7 @@ def _test_pushes(request):
with responses.RequestsMock(assert_all_requests_are_fired=False) as resps:
resps.add_callback(
responses.GET,
re.compile("https://hg.mozilla.org/(.+)/json-rev/(.+)"),
re.compile("https://hg.mozilla.org/(.+)/json-automationrelevance/(.+)"),
callback=_test_rev,
)
resps.add_callback(
Expand Down