Skip to content

Commit 634fa5e

Browse files
committed
bot: Start triggering missing revisions from the most recent one
Since they are the most interesting.
1 parent c6929c8 commit 634fa5e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

bot/code_coverage_bot/trigger_missing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def trigger_missing(server_address: str, out_dir: str = ".") -> None:
104104

105105
task_group_id = slugId()
106106
logger.info(f"Triggering tasks in the {task_group_id} group")
107-
for revision, timestamp in missing_revisions:
107+
for revision, timestamp in reversed(missing_revisions):
108108
# If it's older than yesterday, we assume the group finished.
109109
# If it is newer than yesterday, we load the group and check if all tasks in it finished.
110110
if timestamp > yesterday:

bot/tests/test_trigger_missing.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def triggerHook(self, hook_group, hook_id, payload):
8888
nonlocal trigger_hook_calls
8989
assert hook_group == "project-relman"
9090
assert hook_id == "code-coverage-repo-production"
91-
rev = revision2 if trigger_hook_calls == 0 else revision4
91+
rev = revision4 if trigger_hook_calls == 0 else revision2
9292
assert payload == {
9393
"REPOSITORY": "https://hg.mozilla.org/mozilla-central",
9494
"REVISION": rev,
@@ -107,11 +107,11 @@ def get_decision_task(branch, revision):
107107
nonlocal get_decision_task_calls
108108
assert branch == "mozilla-central"
109109
if get_decision_task_calls == 0:
110-
assert revision == revision2
110+
assert revision == revision5
111111
elif get_decision_task_calls == 1:
112112
assert revision == revision4
113113
elif get_decision_task_calls == 2:
114-
assert revision == revision5
114+
assert revision == revision2
115115
get_decision_task_calls += 1
116116
return f"decisionTask-{revision}"
117117

@@ -122,17 +122,17 @@ def get_decision_task(branch, revision):
122122
def get_task_details(decision_task_id):
123123
nonlocal get_task_details_calls
124124
if get_task_details_calls == 0:
125-
assert decision_task_id == f"decisionTask-{revision2}"
125+
assert decision_task_id == f"decisionTask-{revision5}"
126126
get_task_details_calls += 1
127-
return {"taskGroupId": f"decisionTaskGroup-{revision2}"}
127+
return {"taskGroupId": f"decisionTaskGroup-{revision5}"}
128128
elif get_task_details_calls == 1:
129129
assert decision_task_id == f"decisionTask-{revision4}"
130130
get_task_details_calls += 1
131131
return {"taskGroupId": f"decisionTaskGroup-{revision4}"}
132132
elif get_task_details_calls == 2:
133-
assert decision_task_id == f"decisionTask-{revision5}"
133+
assert decision_task_id == f"decisionTask-{revision2}"
134134
get_task_details_calls += 1
135-
return {"taskGroupId": f"decisionTaskGroup-{revision5}"}
135+
return {"taskGroupId": f"decisionTaskGroup-{revision2}"}
136136

137137
monkeypatch.setattr(taskcluster, "get_task_details", get_task_details)
138138

@@ -141,12 +141,12 @@ def get_task_details(decision_task_id):
141141
def get_tasks_in_group(group_id):
142142
nonlocal get_tasks_in_group_calls
143143
if get_tasks_in_group_calls == 0:
144-
assert group_id == f"decisionTaskGroup-{revision2}"
144+
assert group_id == f"decisionTaskGroup-{revision5}"
145145
get_tasks_in_group_calls += 1
146146
return [
147147
{
148148
"status": {
149-
"state": "completed",
149+
"state": "running",
150150
},
151151
"task": {
152152
"metadata": {
@@ -171,12 +171,12 @@ def get_tasks_in_group(group_id):
171171
}
172172
]
173173
elif get_tasks_in_group_calls == 2:
174-
assert group_id == f"decisionTaskGroup-{revision5}"
174+
assert group_id == f"decisionTaskGroup-{revision2}"
175175
get_tasks_in_group_calls += 1
176176
return [
177177
{
178178
"status": {
179-
"state": "running",
179+
"state": "completed",
180180
},
181181
"task": {
182182
"metadata": {

0 commit comments

Comments
 (0)