diff --git a/src/taskgraph/util/verify.py b/src/taskgraph/util/verify.py index 594388019..357cc7d9a 100644 --- a/src/taskgraph/util/verify.py +++ b/src/taskgraph/util/verify.py @@ -351,14 +351,14 @@ def verify_run_task_caches(task, taskgraph, scratch_pad, graph_config, parameter if not run_task: raise Exception( - f"{task['label']} is using a cache ({cache}) reserved for run-task " + f"{task.label} is using a cache ({cache}) reserved for run-task " "change the task to use run-task or use a different " "cache name" ) if suffix not in cache: raise Exception( - f"{task['label']} is using a cache ({cache}) reserved for run-task " + f"{task.label} is using a cache ({cache}) reserved for run-task " "but the cache name is not dependent on the contents " "of run-task; change the cache name to conform to the " "naming requirements" diff --git a/test/test_util_verify.py b/test/test_util_verify.py index 3218daf09..359afdf85 100644 --- a/test/test_util_verify.py +++ b/test/test_util_verify.py @@ -265,6 +265,43 @@ def make_task_treeherder(label, symbol, platform="linux/opt"): pytest.raises(Exception), id="dependencies over limit", ), + pytest.param( + "verify_run_task_caches", + make_graph( + make_task("task1", task_def={"payload": {"cache": {"foo": {}}}}) + ), + pytest.raises(Exception, match="not appropriate for its trust-domain"), + id="using cache with wrong trust-domain", + ), + pytest.param( + "verify_run_task_caches", + make_graph( + make_task( + "task1", + task_def={ + "payload": {"cache": {"test-domain-level-1-checkouts": {}}} + }, + ) + ), + pytest.raises(Exception, match="reserved for run-task"), + id="using reserved cache", + ), + pytest.param( + "verify_run_task_caches", + make_graph( + make_task( + "task1", + task_def={ + "payload": { + "cache": {"test-domain-level-1-checkouts": {}}, + "command": ["run-task"], + } + }, + ) + ), + pytest.raises(Exception, match="cache name is not dep"), + id="using run-task without cache suffix", + ), ), ) @pytest.mark.filterwarnings("error")