|
18 | 18 | decide_version_combinations, |
19 | 19 | fetch_supported_nodejs_versions, |
20 | 20 | find_new_or_updated, |
| 21 | + latest_tag_key, |
21 | 22 | load_build_contexts, |
22 | 23 | scrape_supported_python_versions, |
23 | 24 | ) |
@@ -289,3 +290,101 @@ def test_find_new_or_updated_with_digest() -> None: |
289 | 290 | res = find_new_or_updated([new], {existing.key: existing}) |
290 | 291 |
|
291 | 292 | assert len(res) == 0 |
| 293 | + |
| 294 | + |
| 295 | +@responses.activate |
| 296 | +def test_latest_tag_key_matches_legacy_latest_sources() -> None: |
| 297 | + responses.add( |
| 298 | + method="GET", |
| 299 | + url="https://registry.hub.docker.com/v2/namespaces/library/repositories/python/tags?page=1&page_size=100", |
| 300 | + json={ |
| 301 | + "count": 3, |
| 302 | + "next": None, |
| 303 | + "previous": None, |
| 304 | + "results": [ |
| 305 | + { |
| 306 | + "name": "3.13.12-trixie", |
| 307 | + "images": [{"os": "linux", "architecture": "amd64"}, {"os": "linux", "architecture": "arm64"}], |
| 308 | + }, |
| 309 | + { |
| 310 | + "name": "3.14.3-trixie", |
| 311 | + "images": [{"os": "linux", "architecture": "amd64"}, {"os": "linux", "architecture": "arm64"}], |
| 312 | + }, |
| 313 | + { |
| 314 | + "name": "3.14.3-alpine", |
| 315 | + "images": [{"os": "linux", "architecture": "amd64"}], |
| 316 | + }, |
| 317 | + ], |
| 318 | + }, |
| 319 | + ) |
| 320 | + responses.add( |
| 321 | + method="GET", |
| 322 | + url="https://nodejs.org/dist/latest/SHASUMS256.txt", |
| 323 | + body="deadbeef node-v25.8.1-linux-x64.tar.xz\n", |
| 324 | + ) |
| 325 | + versions = [ |
| 326 | + BuildVersion( |
| 327 | + key="python3.14-nodejs25", |
| 328 | + python="3.14", |
| 329 | + python_canonical="3.14.3", |
| 330 | + python_image="3.14.3-trixie", |
| 331 | + nodejs="25", |
| 332 | + nodejs_canonical="25.8.1", |
| 333 | + distro="trixie", |
| 334 | + platforms=["linux/amd64", "linux/arm64"], |
| 335 | + ), |
| 336 | + BuildVersion( |
| 337 | + key="python3.14-nodejs24-bookworm", |
| 338 | + python="3.14", |
| 339 | + python_canonical="3.14.3", |
| 340 | + python_image="3.14.3-bookworm", |
| 341 | + nodejs="24", |
| 342 | + nodejs_canonical="24.14.0", |
| 343 | + distro="bookworm", |
| 344 | + platforms=["linux/amd64", "linux/arm64"], |
| 345 | + ), |
| 346 | + ] |
| 347 | + |
| 348 | + assert latest_tag_key(versions) == "python3.14-nodejs25" |
| 349 | + |
| 350 | + |
| 351 | +@responses.activate |
| 352 | +def test_latest_tag_key_fails_if_canonical_build_is_missing() -> None: |
| 353 | + responses.add( |
| 354 | + method="GET", |
| 355 | + url="https://registry.hub.docker.com/v2/namespaces/library/repositories/python/tags?page=1&page_size=100", |
| 356 | + json={ |
| 357 | + "count": 1, |
| 358 | + "next": None, |
| 359 | + "previous": None, |
| 360 | + "results": [ |
| 361 | + { |
| 362 | + "name": "3.14.3-trixie", |
| 363 | + "images": [{"os": "linux", "architecture": "amd64"}, {"os": "linux", "architecture": "arm64"}], |
| 364 | + }, |
| 365 | + ], |
| 366 | + }, |
| 367 | + ) |
| 368 | + responses.add( |
| 369 | + method="GET", |
| 370 | + url="https://nodejs.org/dist/latest/SHASUMS256.txt", |
| 371 | + body="deadbeef node-v25.8.1-linux-x64.tar.xz\n", |
| 372 | + ) |
| 373 | + versions = [ |
| 374 | + BuildVersion( |
| 375 | + key="python3.14-nodejs24", |
| 376 | + python="3.14", |
| 377 | + python_canonical="3.14.3", |
| 378 | + python_image="3.14.3-trixie", |
| 379 | + nodejs="24", |
| 380 | + nodejs_canonical="24.14.0", |
| 381 | + distro="trixie", |
| 382 | + platforms=["linux/amd64", "linux/arm64"], |
| 383 | + ), |
| 384 | + ] |
| 385 | + |
| 386 | + with pytest.raises( |
| 387 | + ValueError, |
| 388 | + match=r"Computed latest tag 'python3\.14-nodejs25' was not part of the current build set", |
| 389 | + ): |
| 390 | + latest_tag_key(versions) |
0 commit comments