Skip to content

Commit b701e6d

Browse files
fix: get_artifact_from_index now uses artifact_path instead of index_path (bug 1999039) (#874)
1 parent 94f47da commit b701e6d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/taskgraph/util/taskcluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def pagination_handler(response):
231231
def get_artifact_from_index(index_path, artifact_path):
232232
index = get_taskcluster_client("index")
233233
response = index.findArtifactFromTask(index_path, artifact_path)
234-
return _handle_artifact(index_path, response)
234+
return _handle_artifact(artifact_path, response)
235235

236236

237237
def list_tasks(index_path):

test/test_util_taskcluster.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,21 @@ def test_get_artifact_from_index(responses, root_url):
243243
assert result.read() == b"foobar"
244244

245245

246+
def test_get_artifact_from_index_uses_artifact_path_for_parsing(responses, root_url):
247+
# Verify artifact_path (not index_path) is used for determining how to parse the response.
248+
index_path = "foo.bar"
249+
artifact_path = "file.yml"
250+
tc.get_taskcluster_client.cache_clear()
251+
252+
responses.get(
253+
f"{root_url}/api/index/v1/task/{index_path}/artifacts/{artifact_path}",
254+
body=b"key: value",
255+
)
256+
257+
result = tc.get_artifact_from_index(index_path, artifact_path)
258+
assert result == {"key": "value"}
259+
260+
246261
def test_list_tasks(responses, root_url):
247262
index = "foo"
248263
tc.get_taskcluster_client.cache_clear()

0 commit comments

Comments
 (0)