Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/taskgraph/util/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,25 @@ def verify_routes_notification_filters(
)


@verifications.add("full_task_graph")
def verify_index_route(task, taskgraph, scratch_pad, graph_config, parameters):
"""
This function ensures that routes do not contain forward slashes.
"""
if task is None:
return
task_dict = task.task
routes = task_dict.get("routes", [])
route_prefix = "index."

for route in routes:
# Check for invalid / in the index route
if route.startswith(route_prefix) and "/" in route:
raise Exception(
f"{task.label} has invalid route with forward slash: {route}"
)


@verifications.add("full_task_graph")
def verify_dependency_tiers(task, taskgraph, scratch_pad, graph_config, parameters):
tiers = scratch_pad
Expand Down
15 changes: 15 additions & 0 deletions test/test_util_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,21 @@ def make_task_treeherder(label, symbol, platform="linux/opt"):
DeprecationWarning,
id="routes_notfication_filter: deprecated",
),
pytest.param(
"verify_index_route",
make_graph(
make_task(
"invalid_slash",
task_def={
"routes": [
"index.example.com/foobar.v2.latest.taskgraph.decision"
]
},
),
),
Exception,
id="verify_index_route: invalid slash in route",
),
),
)
@pytest.mark.filterwarnings("error")
Expand Down
Loading