Skip to content

Commit 43d9aa1

Browse files
abhishekmadan30ahal
authored andcommitted
updated verification
1 parent 24c097d commit 43d9aa1

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

src/taskgraph/util/verify.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@ def verify_trust_domain_v2_routes(
172172

173173
for route in routes:
174174
if route.startswith(route_prefix):
175-
# Check for invalid / in the route
176-
if "/" in route:
177-
raise Exception(
178-
f"{task.label} has invalid route with forward slash: {route}"
179-
)
180175
if route in scratch_pad:
181176
raise Exception(
182177
f"conflict between {task.label}:{scratch_pad[route]} for route: {route}"
@@ -214,11 +209,6 @@ def verify_routes_notification_filters(
214209

215210
for route in routes:
216211
if route.startswith(route_prefix):
217-
# Check for invalid / in the route
218-
if "/" in route:
219-
raise Exception(
220-
f"{task.label} has invalid route with forward slash: {route}"
221-
)
222212
# Get the filter of the route
223213
route_filter = route.split(".")[-1]
224214
if route_filter not in valid_filters:
@@ -233,6 +223,25 @@ def verify_routes_notification_filters(
233223
)
234224
)
235225

226+
@verifications.add("full_task_graph")
227+
def verify_routes_invalid_slash(
228+
task, taskgraph, scratch_pad, graph_config, parameters
229+
):
230+
"""
231+
This function ensures that routes do not contain forward slashes.
232+
"""
233+
if task is None:
234+
return
235+
task_dict = task.task
236+
routes = task_dict.get("routes", [])
237+
238+
for route in routes:
239+
# Check for invalid / in the route
240+
if "/" in route:
241+
raise Exception(
242+
f"{task.label} has invalid route with forward slash: {route}"
243+
)
244+
236245

237246
@verifications.add("full_task_graph")
238247
def verify_dependency_tiers(task, taskgraph, scratch_pad, graph_config, parameters):

test/test_util_verify.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def make_task_treeherder(label, symbol, platform="linux/opt"):
200200
id="routes_notfication_filter: deprecated",
201201
),
202202
pytest.param(
203-
"verify_routes_notification_filters",
203+
"verify_routes_invalid_slash",
204204
make_graph(
205205
make_task(
206206
"invalid_slash",
@@ -212,7 +212,7 @@ def make_task_treeherder(label, symbol, platform="linux/opt"):
212212
),
213213
),
214214
Exception,
215-
id="routes_notification_filter: invalid slash in route",
215+
id="routes_invalid_slash: invalid slash in route",
216216
),
217217
),
218218
)

0 commit comments

Comments
 (0)