Skip to content

Commit d8bc199

Browse files
committed
test(release): keep feed snapshot checks version-agnostic
1 parent 6f937d4 commit d8bc199

1 file changed

Lines changed: 32 additions & 57 deletions

File tree

packages/browseros/bos_build/release/feeds/publisher_test.py

Lines changed: 32 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
render_update_manifest,
2626
)
2727
from .spec import (
28+
EXTENSIONS,
2829
all_feeds,
2930
browser_feeds_for_product,
3031
feed_by_key,
@@ -1075,69 +1076,43 @@ def test_mixed_repair_batch_is_retry_safe(self):
10751076
)
10761077
self.assertEqual(self.client.calls, [])
10771078

1078-
def test_repaired_snapshots_preserve_versions_and_original_payloads(self):
1079+
def test_tracked_snapshots_have_canonical_metadata(self):
10791080
updates = Path(__file__).resolve().parents[5] / "updates"
1080-
server_cases = (
1081-
(
1082-
"appcast-server.xml",
1083-
"0.0.127",
1084-
(
1085-
("BrowserOS Server", "BrowserOS Server (Alpha)"),
1086-
("appcast-server.xml", "appcast-server.alpha.xml"),
1087-
(
1088-
"BrowserOS Server binary updates",
1089-
"BrowserOS Server (Alpha) binary updates",
1090-
),
1091-
),
1092-
"45a2ee4835b11d964584bdfc6c8d3c555d1384cbcbc91e7eb14aa97c3ba8fedf",
1093-
),
1094-
(
1095-
"appcast-claw-server.xml",
1096-
"0.0.15",
1097-
(
1098-
(
1099-
"BrowserOS Claw Server",
1100-
"BrowserOS Claw Server (Alpha)",
1101-
),
1102-
(
1103-
"appcast-claw-server.xml",
1104-
"appcast-claw-server.alpha.xml",
1105-
),
1106-
(
1107-
"BrowserOS Claw Server binary updates",
1108-
"BrowserOS Claw Server (Alpha) binary updates",
1109-
),
1110-
),
1111-
"1df47182d63006294b87323d276896e489f141f2aed1f0266a2119c9ffef3eef",
1112-
),
1113-
)
11141081

1115-
for filename, version, replacements, old_hash in server_cases:
1116-
with self.subTest(filename=filename):
1117-
content = (updates / "server" / filename).read_text()
1118-
spec = feed_by_key(filename)
1082+
# These files are release outputs, so pin stable schema and ownership
1083+
# invariants instead of versions or whole-file hashes. Otherwise every
1084+
# valid snapshot promotion makes the default branch's test suite stale.
1085+
for bundle_id in ("browseros-server", "browserclaw-server"):
1086+
spec = server_feed(bundle_id, "prod")
1087+
with self.subTest(key=spec.key):
1088+
content = (updates / "server" / spec.key).read_text()
11191089
self.assertEqual((spec.kind, spec.channel), ("server", "prod"))
1120-
self.assertEqual(extract_appcast_version(content), version)
1121-
original = content
1122-
for corrected, invalid in replacements:
1123-
original = original.replace(corrected, invalid, 1)
11241090
self.assertEqual(
1125-
hashlib.sha256(original.encode()).hexdigest(), old_hash
1091+
extract_channel_metadata(content),
1092+
(spec.title, spec.link),
1093+
)
1094+
self.assertIn(
1095+
f"<description>{spec.title} binary updates</description>",
1096+
content,
11261097
)
1098+
self.assertIsNotNone(extract_appcast_version(content))
11271099

1128-
manifest_path = updates / "extensions" / "update-manifest.alpha.xml"
1129-
manifest = manifest_path.read_text()
1130-
spec = feed_by_key("extensions/update-manifest.alpha.xml")
1131-
self.assertEqual((spec.kind, spec.channel), ("extensions", "alpha"))
1132-
self.assertEqual(
1133-
set(extract_manifest_versions(manifest).values()),
1134-
{"0.0.139.0", "54.0.0.0", "0.2.15.0"},
1135-
)
1136-
original = manifest.replace("</gupdate>", " </app>\n</gupdate>")
1137-
self.assertEqual(
1138-
hashlib.sha256(original.encode()).hexdigest(),
1139-
"d2a7b386ea9928cb4ae4f0a8537f304db19e7e17e51178feecbe2f5a90f08fb7",
1140-
)
1100+
expected_extension_ids = {
1101+
extension.extension_id
1102+
for extension in EXTENSIONS
1103+
if extension.in_update_feed
1104+
}
1105+
for channel in ("alpha", "prod"):
1106+
spec = update_manifest_feed(channel)
1107+
with self.subTest(key=spec.key):
1108+
manifest = (updates / spec.key).read_text()
1109+
self.assertEqual(
1110+
(spec.kind, spec.channel), ("extensions", channel)
1111+
)
1112+
self.assertEqual(
1113+
set(extract_manifest_versions(manifest)),
1114+
expected_extension_ids,
1115+
)
11411116

11421117
def test_browserclaw_snapshots_use_current_product_title(self):
11431118
updates = Path(__file__).resolve().parents[5] / "updates" / "browser"

0 commit comments

Comments
 (0)