Page MenuHomeSoftware Heritage

D2859.diff
No OneTemporary

D2859.diff

diff --git a/swh/loader/package/functional/tests/data/https_fail.com/truncated-archive.tgz b/swh/loader/package/functional/tests/data/https_fail.com/truncated-archive.tgz
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/swh/loader/package/functional/tests/data/https_nix-community.github.io/nixpkgs-swh_sources-EOFError.json b/swh/loader/package/functional/tests/data/https_nix-community.github.io/nixpkgs-swh_sources-EOFError.json
new file mode 100644
--- /dev/null
+++ b/swh/loader/package/functional/tests/data/https_nix-community.github.io/nixpkgs-swh_sources-EOFError.json
@@ -0,0 +1,10 @@
+{
+ "sources": [
+ {
+ "type": "url",
+ "url": [ "https://fail.com/truncated-archive.tgz" ]
+ }
+ ],
+ "version": 1,
+ "revision": "cc4e04c26672dd74e5fd0fecb78b435fb55368f7"
+}
diff --git a/swh/loader/package/functional/tests/test_functional.py b/swh/loader/package/functional/tests/test_functional.py
--- a/swh/loader/package/functional/tests/test_functional.py
+++ b/swh/loader/package/functional/tests/test_functional.py
@@ -250,3 +250,27 @@
}
check_snapshot(expected_snapshot, storage=loader.storage)
+
+
+def test_eoferror(swh_config, requests_mock_datadir):
+ """Load a truncated archive which is invalid to make the uncompress
+ function raising the exception EOFError. We then check if a
+ snapshot is created, meaning this error is well managed.
+
+ """
+ sources = "https://nix-community.github.io/nixpkgs-swh/sources-EOFError.json" # noqa
+ loader = FunctionalLoader(sources)
+ loader.load()
+
+ expected_branches = {
+ 'evaluation': {
+ 'target': 'cc4e04c26672dd74e5fd0fecb78b435fb55368f7',
+ 'target_type': 'revision',
+ },
+ }
+ expected_snapshot = {
+ 'id': '4257fa2350168c6bfec726a06452ea27a2c0cb33',
+ 'branches': expected_branches,
+ }
+
+ check_snapshot(expected_snapshot, storage=loader.storage)

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 17, 5:53 PM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221587

Event Timeline