[PATCH b4 v2 07/44] tests: cover an unwritable series archive

Christian Brauner <[email protected]> Fri, 31 Jul 2026 23:58:48 +0200
Newsgroups org.kernel.linux.tools
Message-ID <20260731-work-b4-editor-branch-guard-v2-7-243fd19d322d@kernel.org>
A failing write comes back as (False, detail) and leaves the review
branch and the series status alone, so the archive can be retried.

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 src/tests/test_review.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/tests/test_review.py b/src/tests/test_review.py
index b0e924e..5fdb608 100644
--- a/src/tests/test_review.py
+++ b/src/tests/test_review.py
@@ -4742,3 +4742,24 @@ class TestArchiveSeries:
         assert ok, detail
         assert not b4.git_branch_exists(repo, branch)
         assert self._db_status() == 'archived'
+
+    def test_unwritable_archive_is_reported_not_raised(
+        self, tmp_path: Any, monkeypatch: pytest.MonkeyPatch
+    ) -> None:
+        """Archiving happens after a thank-you has gone out, so an I/O
+        failure must come back as (False, detail).  Raising here would be
+        caught upstream and shown as a send failure, telling the maintainer
+        to send a note that is already on the list."""
+        repo = self._make_repo(tmp_path)
+        branch = f'b4/review/{self.CHANGE_ID}'
+
+        def boom(*args: Any, **kwargs: Any) -> None:
+            raise OSError(28, 'No space left on device')
+
+        monkeypatch.setattr('b4.ez.write_to_tar', boom)
+        ok, detail = review.archive_series(repo, self.IDENTIFIER, self.CHANGE_ID, 1)
+        assert not ok
+        assert 'No space left on device' in detail
+        # Nothing was destroyed, so the maintainer can simply retry
+        assert b4.git_branch_exists(repo, branch)
+        assert self._db_status() == 'accepted'

-- 
2.53.0