fat-catTW commented on code in PR #76381:
URL: https://github.com/apache/airflow/pull/76381#discussion_r4610494562
##########
providers/common/ai/tests/unit/common/ai/durable/test_storage.py:
##########
@@ -84,6 +84,44 @@ def test_a_retry_reads_what_the_previous_attempt_wrote(self,
storage):
def test_missing_key_is_none(self, storage):
assert storage.load_step("missing") is None
+ @patch.object(storage_module, "log", spec=FilteringBoundLogger)
+ @patch.object(ObjectStoragePath, "read_text", autospec=True,
side_effect=OSError("S3 is unavailable"))
+ def
test_a_storage_read_failure_stops_the_task_before_it_can_replay_live(self, _,
mock_log, storage):
+ with pytest.raises(OSError, match="S3 is unavailable"):
+ storage.load_step("k")
+
+ mock_log.warning.assert_called_once_with(
+ "Durable: could not read the journal; failing this attempt so
finished steps don't run again",
+ path=str(storage._get_path()),
+ )
+
+ @pytest.mark.parametrize(
+ ("contents", "expected_exception"),
+ [(b'{"k":', json.JSONDecodeError), (b"\xff", UnicodeDecodeError)],
+ ids=["truncated-json", "invalid-encoding"],
+ )
+ @patch.object(storage_module, "log", spec=FilteringBoundLogger)
+ def test_a_corrupt_journal_blocks_reads_and_writes(
Review Comment:
Done.
Merged the invalid UTF-8 case and warning assertion into the existing
parametrized test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]