From b96e23ec46e2984197cad0f3cb172b9ca9ca2768 Mon Sep 17 00:00:00 2001
From: Antoine Lambert <anlambert@softwareheritage.org>
Date: Wed, 8 Nov 2023 14:53:31 +0100
Subject: [PATCH] package/nixguix: Adapt tests data to ensure all tarballs are
 different

This is required after the changes introduced in 54d8c7d and it is also
more consistent with real data provided by nix or guix.

Moreover, this loader should be removed soon as a better lister have been
implemented for nixguix that no longer create loading tasks with nixguix
visit type.
---
 .../owner-3_repository-1_revision-1.tgz         | Bin 35 -> 188 bytes
 .../nixpkgs-swh_sources.json                    |   2 +-
 .../package/nixguix/tests/test_nixguix.py       |  16 ++++++++--------
 3 files changed, 9 insertions(+), 9 deletions(-)
 mode change 120000 => 100644 swh/loader/package/nixguix/tests/data/https_github.com/owner-3_repository-1_revision-1.tgz

diff --git a/swh/loader/package/nixguix/tests/data/https_github.com/owner-3_repository-1_revision-1.tgz b/swh/loader/package/nixguix/tests/data/https_github.com/owner-3_repository-1_revision-1.tgz
deleted file mode 120000
index ae1450fc..00000000
--- a/swh/loader/package/nixguix/tests/data/https_github.com/owner-3_repository-1_revision-1.tgz
+++ /dev/null
@@ -1 +0,0 @@
-owner-1_repository-1_revision-1.tgz
\ No newline at end of file
diff --git a/swh/loader/package/nixguix/tests/data/https_github.com/owner-3_repository-1_revision-1.tgz b/swh/loader/package/nixguix/tests/data/https_github.com/owner-3_repository-1_revision-1.tgz
new file mode 100644
index 0000000000000000000000000000000000000000..3bb121207f786a7b6b3e7f38841adc412045327f
GIT binary patch
literal 188
zcmb2|=3oE==C_wFavf3-X-HgO&2?X)|ME|p)nYu;n73E``;@d;&rKx4<$t;IiU*DN
zuf*-zDE%mGYI0uF_sXdc&i=Iu4!SyZ<Fy-m^rspx+M;i9`H_vE@1-cyjro4N&3v`L
z&zt*yg~@mOl9gBFD^}L0=Kr1h!{NVw#4q{X`*gp!@x@qgzZdV)`S}`~;klo8?(d4q
l49=LxUVpFN{>aMS$#-k21t2bjkb9nTd78iEW6)q=00862R#*T4

literal 0
HcmV?d00001

diff --git a/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json b/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json
index 401c0ed1..aaa6d1c3 100644
--- a/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json
+++ b/swh/loader/package/nixguix/tests/data/https_nix-community.github.io/nixpkgs-swh_sources.json
@@ -8,7 +8,7 @@
     {
       "type": "url",
       "urls": [ "https://github.com/owner-3/repository-1/revision-1.tgz" ],
-      "integrity": "sha256-3vm2Nt+O4zHf3Ovd/qsv1gKTEUwodX9FLxlrQdry0zs="
+      "integrity": "sha256-sovQhmpumj0DpISN2c1QCLY6esueeV81zR/1CeUC13Q="
     },
     {
       "type": "url",
diff --git a/swh/loader/package/nixguix/tests/test_nixguix.py b/swh/loader/package/nixguix/tests/test_nixguix.py
index 79159d2a..334f62bf 100644
--- a/swh/loader/package/nixguix/tests/test_nixguix.py
+++ b/swh/loader/package/nixguix/tests/test_nixguix.py
@@ -57,7 +57,6 @@ def raw_sources(datadir) -> bytes:
 
 
 SNAPSHOT1 = Snapshot(
-    id=hash_to_bytes("fafcfe32016d018bd892114fce211f37a36a092a"),
     branches={
         b"evaluation": SnapshotBranch(
             target=hash_to_bytes("cc4e04c26672dd74e5fd0fecb78b435fb55368f7"),
@@ -68,7 +67,7 @@ SNAPSHOT1 = Snapshot(
             target_type=TargetType.RELEASE,
         ),
         b"https://github.com/owner-3/repository-1/revision-1.tgz": SnapshotBranch(
-            target=hash_to_bytes("dc7dc10a664396d5c88adc56352904db231bde14"),
+            target=hash_to_bytes("adbc07c7d5654aa9ecf7b4fd8ec79083477f5b51"),
             target_type=TargetType.RELEASE,
         ),
     },
@@ -309,8 +308,8 @@ def test_loader_one_visit(swh_storage, requests_mock_datadir, raw_sources):
 
     stats = get_stats(swh_storage)
     assert {
-        "content": 1,
-        "directory": 3,
+        "content": 2,
+        "directory": 5,
         "origin": 1,
         "origin_visit": 1,
         "release": 2,
@@ -437,8 +436,8 @@ def test_loader_two_visits(swh_storage, requests_mock_datadir_visits):
 
     stats = get_stats(swh_storage)
     assert {
-        "content": 1,
-        "directory": 3,
+        "content": 2,
+        "directory": 5,
         "origin": 1,
         "origin_visit": 1,
         "release": 2,
@@ -449,6 +448,7 @@ def test_loader_two_visits(swh_storage, requests_mock_datadir_visits):
 
     loader = NixGuixLoader(swh_storage, sources_url)
     load_status = loader.load()
+
     expected_snapshot_id_hex = "c1983a0a3f647548e1fb92f30339da6848fe9f7a"
     expected_snapshot_id = hash_to_bytes(expected_snapshot_id_hex)
     assert load_status == {
@@ -488,8 +488,8 @@ def test_loader_two_visits(swh_storage, requests_mock_datadir_visits):
 
     stats = get_stats(swh_storage)
     assert {
-        "content": 2,
-        "directory": 5,
+        "content": 3,
+        "directory": 7,
         "origin": 1,
         "origin_visit": 2,
         "release": 3,
-- 
GitLab