Skip to content

Commit fd3b621

Browse files
authored
fix: use job name as prefix to integration test tasks instead of hardcoding 'gecko' (#224)
1 parent 00ee798 commit fd3b621

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

taskcluster/fxci_config_taskgraph/transforms/integration_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def rewrite_private_fetches(taskdesc: dict[str, Any]) -> None:
144144
payload["env"]["MOZ_FETCHES"] = {"task-reference": json.dumps(fetches)}
145145

146146

147-
def make_integration_test_description(task_def: dict[str, Any]):
147+
def make_integration_test_description(task_def: dict[str, Any], name_prefix: str):
148148
"""Schedule a task on the staging Taskcluster instance.
149149
150150
Typically task_def will come from the firefox-ci instance and will be
@@ -173,15 +173,15 @@ def make_integration_test_description(task_def: dict[str, Any]):
173173
if key in task_def:
174174
task_def[key] = task_def[key].replace("3", "1")
175175

176-
task_def["metadata"]["name"] = f"gecko-{task_def['metadata']['name']}"
176+
task_def["metadata"]["name"] = f"{name_prefix}-{task_def['metadata']['name']}"
177177
taskdesc = {
178178
"label": task_def["metadata"]["name"],
179179
"description": task_def["metadata"]["description"],
180180
"task": task_def,
181181
"dependencies": {
182182
"apply": "tc-admin-apply-staging",
183183
},
184-
"attributes": {"integration": "gecko"},
184+
"attributes": {"integration": name_prefix},
185185
}
186186
rewrite_docker_image(taskdesc)
187187
rewrite_private_fetches(taskdesc)
@@ -199,4 +199,4 @@ def schedule_tasks_at_index(config, tasks):
199199
for task in tasks:
200200
for decision_index_path in task.pop("decision-index-paths"):
201201
for task_def in find_tasks(decision_index_path):
202-
yield make_integration_test_description(task_def)
202+
yield make_integration_test_description(task_def, task["name"])

taskcluster/test/test_transforms_integration_test.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ def run_test(monkeypatch, run_transform, responses):
4747
json={"taskId": decision_task_id},
4848
)
4949

50-
def inner(task: dict[str, Any]) -> dict[str, Any] | None:
50+
# `name` may seem like an awkard identifier here, but outside of tests
51+
# this comes from the keys in a `kind`. `task_label` is not really
52+
# an ideal default, but it's the best option we have here, and this value
53+
# is irrelevant to many tests anyways.
54+
def inner(task: dict[str, Any], name: str = task_label) -> dict[str, Any] | None:
5155
find_tasks.cache_clear()
5256

5357
task = merge(deepcopy(base_task), task)
@@ -59,7 +63,9 @@ def inner(task: dict[str, Any]) -> dict[str, Any] | None:
5963
json=task_graph,
6064
)
6165

62-
result = run_transform(transforms, {"decision-index-paths": [index]})
66+
result = run_transform(
67+
transforms, {"decision-index-paths": [index], "name": name}
68+
)
6369
if not result:
6470
return None
6571

@@ -109,7 +115,7 @@ def test_android_hw_skipped(run_test):
109115

110116

111117
def test_basic(run_test):
112-
result = run_test({"attributes": {"unittest_variant": "os-integration"}})
118+
result = run_test({"attributes": {"unittest_variant": "os-integration"}}, "gecko")
113119
assert result == {
114120
"attributes": {"integration": "gecko"},
115121
"dependencies": {"apply": "tc-admin-apply-staging"},
@@ -133,7 +139,8 @@ def test_docker_image(run_test):
133139
{
134140
"attributes": {"unittest_variant": "os-integration"},
135141
"task": {"payload": {"image": {"taskId": "def"}}},
136-
}
142+
},
143+
"gecko",
137144
)
138145
assert result["dependencies"] == {
139146
"apply": "tc-admin-apply-staging",
@@ -225,7 +232,8 @@ def test_private_artifact(run_test):
225232
"env": {"MOZ_FETCHES": '[{"task": "def", "artifact": "foo.txt"}]'},
226233
}
227234
},
228-
}
235+
},
236+
"gecko",
229237
)
230238
assert result["dependencies"] == {
231239
"apply": "tc-admin-apply-staging",

0 commit comments

Comments
 (0)