def before_iterations(kw): global build_generator if "fenix_nightlysim_multicommit" not in kw.get("android_install_apk")[0]: return # Get the builds to test build_url = get_multi_tasks_url(NIGHTLY_SIM_ROUTE, day=kw["test_date"]) tmpfile = pathlib.Path(tempfile.mkdtemp(), "alltasks.json") download_file(build_url, tmpfile) # Set the number of test-iterations to the number of builds with tmpfile.open() as f: tasks = json.load(f)["tasks"] kw["test_iterations"] = len(tasks) # Finally, make an iterator for the builds (used in `before_runs`) route_suffix = G5_SUFFIX if "arm64_v8a" in kw.get("android_install_apk"): route_suffix = P2_SUFFIX def _build_iterator(route_suffix): for task in tasks: route = task["namespace"] revision = route.split(".")[-1] print("Testing revision %s" % revision) download_url = "%s%s/%s" % (_ROOT_URL, route, route_suffix) yield revision, [download_url] build_generator = _build_iterator(route_suffix) return kw
def test_multibuild_url(): route = "FakeBuildRoute" day = "2020.06.08" buildurl = get_multi_tasks_url(route, day=day) assert day in buildurl and route in buildurl with mock.patch("mozperftest.utils.date") as mockeddate: mockeddate.today.return_value = mockeddate mockeddate.strftime.return_value = "2020.07.09" buildurl = get_multi_tasks_url(route, day="today") assert "2020.07.09" in buildurl and route in buildurl with mock.patch("mozperftest.utils.timedelta"): mockeddate.__sub__.return_value = mockeddate mockeddate.strftime.return_value = "2020.08.09" buildurl = get_multi_tasks_url(route) assert "2020.08.09" in buildurl and route in buildurl
def test_multibuild_url(): route = "FakeBuildRoute" day = "2020.06.08" revision = "deadbeef" buildurl = get_multi_tasks_url(route, revision, day=day) assert all(item in buildurl for item in (route, day, revision)) with mock.patch("mozperftest.utils.date") as mockeddate: mockeddate.today.return_value = mockeddate mockeddate.strftime.return_value = "2020.07.09" buildurl = get_multi_tasks_url(route, revision, day="today") assert "2020.07.09" in buildurl and route in buildurl with mock.patch("mozperftest.utils.timedelta"): mockeddate.__sub__.return_value = mockeddate mockeddate.strftime.return_value = "2020.08.09" buildurl = get_multi_tasks_url(route, revision) assert "2020.08.09" in buildurl and route in buildurl