@@ -68,44 +68,46 @@ def test_load_metadata_sorts_by_rust_version_then_key_then_arch(tmp_path: Path)
6868 ]
6969
7070
71- def test_rust_keys_newest_first_orders_by_version_desc () -> None :
71+ def _pin_rows (label : str , version : str , digest15 : str ) -> list [dict ]:
72+ base = f"26.0.0-abc123-rust{ label } -{ digest15 } "
73+ return [
74+ {
75+ "arch" : arch ,
76+ "digest" : "sha256:" + char * 64 ,
77+ "rust_base_key" : label ,
78+ "rust_version" : version ,
79+ "tag" : f"{ base } -{ arch } " ,
80+ }
81+ for arch , char in (("amd64" , "1" ), ("arm64" , "2" ))
82+ ]
83+
84+
85+ def test_pins_newest_first_orders_by_version_desc () -> None :
7286 rows = [
73- {"rust_base_key" : "1.94.0-slim-trixie" , "rust_version" : "1.94.0" },
74- {"rust_base_key" : "1.100.0-slim-trixie" , "rust_version" : "1.100.0" },
75- {"rust_base_key" : "1.94.0-slim-trixie" , "rust_version" : "1.94.0" }, # dup
87+ * _pin_rows ("1.94.0-slim-trixie" , "1.94.0" , "a" * 15 ),
88+ * _pin_rows ("1.100.0-slim-trixie" , "1.100.0" , "b" * 15 ),
7689 ]
77- assert release_body .rust_keys_newest_first (rows ) == [
78- "1. 100.0-slim-trixie" ,
79- "1. 94.0-slim-trixie" ,
90+ assert release_body .pins_newest_first (rows ) == [
91+ "26.0.0-abc123-rust1. 100.0-slim-trixie-" + "b" * 15 ,
92+ "26.0.0-abc123-rust1. 94.0-slim-trixie-" + "a" * 15 ,
8093 ]
8194
8295
8396def test_emit_body_includes_expected_sections () -> None :
84- rows = [
85- {
86- "arch" : "amd64" ,
87- "digest" : "sha256:" + "1" * 64 ,
88- "rust_base_key" : "1.94.0-slim-trixie" ,
89- "rust_version" : "1.94.0" ,
90- },
91- {
92- "arch" : "arm64" ,
93- "digest" : "sha256:" + "2" * 64 ,
94- "rust_base_key" : "1.94.0-slim-trixie" ,
95- "rust_version" : "1.94.0" ,
96- },
97- ]
97+ rows = _pin_rows ("1.94.0-slim-trixie" , "1.94.0" , "f7bf1c266d9e48c" )
9898 body = release_body .emit_body (
9999 cli = "26.0.0" ,
100100 rows = rows ,
101101 registry = "docker.io/stellar/stellar-cli" ,
102102 repo = "stellar/stellar-cli-docker" ,
103103 stellar_ref = "abc123" ,
104104 )
105+ list_tag = "26.0.0-abc123-rust1.94.0-slim-trixie-f7bf1c266d9e48c"
105106 assert "# stellar-cli 26.0.0" in body
106107 assert "## Tags" in body
107108 assert "docker.io/stellar/stellar-cli:latest" in body
108- assert "26.0.0-abc123-rust1.94.0-slim-trixie" in body
109+ assert f"docker.io/stellar/stellar-cli:{ list_tag } " in body
110+ assert f"{ list_tag } -amd64" in body
109111 assert "## Per-architecture digests" in body
110112 assert "### Rust 1.94.0-slim-trixie" in body
111113 assert "linux/amd64" in body
@@ -115,6 +117,24 @@ def test_emit_body_includes_expected_sections() -> None:
115117 assert "docker buildx imagetools inspect" in body
116118 assert "## Verification" in body
117119 assert "## Assets" in body
120+
121+
122+ def test_emit_body_two_digests_same_label_render_distinctly () -> None :
123+ rows = [
124+ * _pin_rows ("1.94.0-slim-trixie" , "1.94.0" , "a" * 15 ),
125+ * _pin_rows ("1.94.0-slim-trixie" , "1.94.0" , "c" * 15 ),
126+ ]
127+ body = release_body .emit_body (
128+ cli = "26.0.0" ,
129+ rows = rows ,
130+ registry = "docker.io/stellar/stellar-cli" ,
131+ repo = "stellar/stellar-cli-docker" ,
132+ stellar_ref = "abc123" ,
133+ )
134+ # Both pins surface as their own multi-arch tag and their own section.
135+ assert "26.0.0-abc123-rust1.94.0-slim-trixie-" + "a" * 15 in body
136+ assert "26.0.0-abc123-rust1.94.0-slim-trixie-" + "c" * 15 in body
137+ assert body .count ("### Rust 1.94.0-slim-trixie" ) == 2
118138 # Each shell-continuation line in the cosign block must end with a single
119139 # backslash, not two — `\\` in the rendered markdown would land as a
120140 # literal `\\` in the user's terminal instead of a line continuation.
0 commit comments