summaryrefslogtreecommitdiffstats
path: root/taskcluster/gecko_taskgraph/test/test_util_backstop.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /taskcluster/gecko_taskgraph/test/test_util_backstop.py
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'taskcluster/gecko_taskgraph/test/test_util_backstop.py')
-rw-r--r--taskcluster/gecko_taskgraph/test/test_util_backstop.py44
1 files changed, 31 insertions, 13 deletions
diff --git a/taskcluster/gecko_taskgraph/test/test_util_backstop.py b/taskcluster/gecko_taskgraph/test/test_util_backstop.py
index af9aabd5af..0a2bdc6ae4 100644
--- a/taskcluster/gecko_taskgraph/test/test_util_backstop.py
+++ b/taskcluster/gecko_taskgraph/test/test_util_backstop.py
@@ -18,20 +18,22 @@ from gecko_taskgraph.util.backstop import (
is_backstop,
)
-LAST_BACKSTOP_ID = 0
+LAST_BACKSTOP_PUSHID = 1
LAST_BACKSTOP_PUSHDATE = mktime(datetime.now().timetuple())
DEFAULT_RESPONSES = {
"index": {
"status": 200,
- "json": {"taskId": LAST_BACKSTOP_ID},
+ "json": {"taskId": LAST_BACKSTOP_PUSHID},
},
"artifact": {
"status": 200,
"body": dedent(
"""
pushdate: {}
+ pushlog_id: "{}"
""".format(
- LAST_BACKSTOP_PUSHDATE
+ LAST_BACKSTOP_PUSHDATE,
+ LAST_BACKSTOP_PUSHID,
)
),
},
@@ -50,7 +52,8 @@ def params():
"head_rev": "abcdef",
"project": "autoland",
"pushdate": LAST_BACKSTOP_PUSHDATE + 1,
- "pushlog_id": LAST_BACKSTOP_ID + 1,
+ "pushlog_id": f"{LAST_BACKSTOP_PUSHID + 1}",
+ "target_tasks_method": "default",
}
@@ -61,7 +64,7 @@ def params():
{
"index": {"status": 404},
},
- {"pushlog_id": 1},
+ {"pushlog_id": "1"},
True,
id="no previous backstop",
),
@@ -78,8 +81,8 @@ def params():
pytest.param(
DEFAULT_RESPONSES,
{
- "pushlog_id": LAST_BACKSTOP_ID + 1,
- "pushdate": LAST_BACKSTOP_PUSHDATE + 1,
+ "pushlog_id": f"{LAST_BACKSTOP_PUSHID + BACKSTOP_PUSH_INTERVAL - 1}",
+ "pushdate": LAST_BACKSTOP_PUSHDATE + (BACKSTOP_TIME_INTERVAL * 60) - 1,
},
False,
id="not a backstop",
@@ -87,10 +90,26 @@ def params():
pytest.param(
{},
{
- "pushlog_id": BACKSTOP_PUSH_INTERVAL,
+ "target_tasks_method": "nothing",
+ },
+ False,
+ id="dontbuild",
+ ),
+ pytest.param(
+ DEFAULT_RESPONSES,
+ {
+ "pushlog_id": f"{LAST_BACKSTOP_PUSHID + BACKSTOP_PUSH_INTERVAL}",
+ },
+ True,
+ id="interval",
+ ),
+ pytest.param(
+ DEFAULT_RESPONSES,
+ {
+ "pushlog_id": f"{LAST_BACKSTOP_PUSHID + BACKSTOP_PUSH_INTERVAL + 1}",
},
True,
- id="backstop interval",
+ id="greater than interval",
),
pytest.param(
DEFAULT_RESPONSES,
@@ -104,7 +123,7 @@ def params():
{},
{
"project": "try",
- "pushlog_id": BACKSTOP_PUSH_INTERVAL,
+ "pushlog_id": f"{BACKSTOP_PUSH_INTERVAL}",
},
False,
id="try not a backstop",
@@ -138,13 +157,12 @@ def test_is_backstop(responses, params, response_args, extra_params, expected):
**{"trust-domain": "gecko", "project": params["project"]}
)
),
- "artifact": get_artifact_url(LAST_BACKSTOP_ID, "public/parameters.yml"),
- "status": get_task_url(LAST_BACKSTOP_ID) + "/status",
+ "artifact": get_artifact_url(LAST_BACKSTOP_PUSHID, "public/parameters.yml"),
+ "status": get_task_url(LAST_BACKSTOP_PUSHID) + "/status",
}
for key in ("index", "status", "artifact"):
if key in response_args:
- print(urls[key])
responses.add(responses.GET, urls[key], **response_args[key])
params.update(extra_params)