v29.4-roots.2 · Commit 8: [PATCH 08/21] ci: restore assurance and isolate Core fixtures
ci/test/test_create_patch_series.py
Before: ci/test/test_create_patch_series.py · After: ci/test/test_create_patch_series.py
File metadata
index 3c9bac53b7094e56532fa69720c4cee83192afcc..56194dbde5fd4bc41bdc2467bc876b9d107bc477 100755
Download original patch · Release notes
Diff rows 1–55 of 55. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
ci/test/test_create_patch_series.py
CHANGED
|
@@ -27,7 +27,10 @@ class CreatePatchSeriesTest(unittest.TestCase):
|
|
|
27
27
|
self.git(repository, "config", "user.name", "Patch test")
|
|
28
28
|
self.git(repository, "config", "user.email", "patch@example.invalid")
|
|
29
29
|
(repository / "source").write_text("core\n", encoding="utf-8")
|
|
30
|
-
self.git(repository, "add", "source")
|
|
30
|
+
workflow = repository / ".github/workflows/ci.yml"
|
|
31
|
+
workflow.parent.mkdir(parents=True)
|
|
32
|
+
workflow.write_text("name: Core CI\n", encoding="utf-8")
|
|
33
|
+
self.git(repository, "add", "source", ".github")
|
|
31
34
|
self.git(repository, "commit", "-m", "core", capture_output=True)
|
|
32
35
|
core_commit = self.git(repository, "rev-parse", "HEAD", capture_output=True, text=True).stdout.strip()
|
|
33
36
|
self.git(repository, "tag", "-a", "v29.4", "-m", "Core v29.4")
|
|
@@ -37,13 +40,14 @@ class CreatePatchSeriesTest(unittest.TestCase):
|
|
|
37
40
|
(repository / "binary.dat").write_bytes(bytes(range(256)))
|
|
38
41
|
self.git(repository, "add", "binary.dat")
|
|
39
42
|
self.git(repository, "commit", "-m", "roots binary", capture_output=True)
|
|
43
|
+
workflow.write_text("name: Roots CI\n", encoding="utf-8")
|
|
44
|
+
self.git(repository, "commit", "-am", "ci: use Roots tests", capture_output=True)
|
|
40
45
|
self.git(repository, "tag", "-a", RELEASE_TAG, "-m", RELEASE_TAG)
|
|
41
|
-
release_tree = self.git(repository, "rev-parse", "HEAD^{tree}", capture_output=True, text=True).stdout.strip()
|
|
42
46
|
self.git(repository, "checkout", "--detach", RELEASE_TAG, capture_output=True)
|
|
43
|
-
return repository, core_commit, release_tree
|
|
47
|
+
return repository, core_commit
|
|
44
48
|
|
|
45
|
-
def test_generates_binary_full_index_series_that_replays_identically(self):
|
|
46
|
-
repository, core_commit, release_tree = self.make_release_repository()
|
|
49
|
+
def test_generates_product_series_and_omits_github_automation(self):
|
|
50
|
+
repository, core_commit = self.make_release_repository()
|
|
47
51
|
output = repository / "artifacts/bitcoin-roots-29.4-roots.1.patch"
|
|
48
52
|
environment = {**os.environ, "RELEASE_CANONICAL_REF": "refs/heads/roots/29.4"}
|
|
49
53
|
subprocess.run([SCRIPT, RELEASE_TAG, output], cwd=repository, env=environment, check=True)
|
|
@@ -52,6 +56,8 @@ class CreatePatchSeriesTest(unittest.TestCase):
|
|
|
52
56
|
self.assertIn("GIT binary patch", patch)
|
|
53
57
|
self.assertIn(f"base-commit: {core_commit}", patch)
|
|
54
58
|
self.assertGreaterEqual(patch.count("Subject: [PATCH"), 2)
|
|
59
|
+
self.assertNotIn("diff --git a/.github/", patch)
|
|
60
|
+
self.assertNotIn("ci: use Roots tests", patch)
|
|
55
61
|
|
|
56
62
|
with tempfile.TemporaryDirectory() as replay_dir:
|
|
57
63
|
replay = Path(replay_dir) / "repository"
|
|
@@ -61,11 +67,15 @@ class CreatePatchSeriesTest(unittest.TestCase):
|
|
|
61
67
|
replay, "-c", "user.name=Patch replay", "-c", "user.email=replay@example.invalid",
|
|
62
68
|
"am", "-3", output, capture_output=True,
|
|
63
69
|
)
|
|
64
|
-
replayed_tree = self.git(replay, "rev-parse", "HEAD^{tree}", capture_output=True, text=True).stdout.strip()
|
|
65
|
-
self.assertEqual(replayed_tree, release_tree)
|
|
70
|
+
self.git(
|
|
71
|
+
replay, "diff", "--quiet", RELEASE_TAG, "HEAD", "--",
|
|
72
|
+
".", ":(exclude).github/**",
|
|
73
|
+
)
|
|
74
|
+
self.git(replay, "diff", "--quiet", core_commit, "HEAD", "--", ".github")
|
|
75
|
+
self.assertEqual((replay / ".github/workflows/ci.yml").read_text(encoding="utf-8"), "name: Core CI\n")
|
|
66
76
|
|
|
67
77
|
def test_rejects_noncanonical_release(self):
|
|
68
|
-
repository, _, _ = self.make_release_repository()
|
|
78
|
+
repository, _ = self.make_release_repository()
|
|
69
79
|
self.git(repository, "branch", "--force", "roots/29.4", "v29.4")
|
|
70
80
|
output = repository / "release.patch"
|
|
71
81
|
result = subprocess.run(
|