Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9313274
D6819.id24700.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D6819.id24700.diff
View Options
diff --git a/swh/storage/tests/storage_data.py b/swh/storage/tests/storage_data.py
--- a/swh/storage/tests/storage_data.py
+++ b/swh/storage/tests/storage_data.py
@@ -317,6 +317,29 @@
)
git_revisions: Tuple[Revision, ...] = (revision, revision2, revision3, revision4)
+ old_revision = Revision(
+ message=None,
+ author=Person(fullname=b"", name=None, email=None),
+ committer=Person(fullname=b"", name=None, email=None),
+ date=TimestampWithTimezone(
+ timestamp=Timestamp(seconds=-1855958962, microseconds=0),
+ offset=0,
+ negative_utc=False,
+ ),
+ committer_date=TimestampWithTimezone(
+ timestamp=Timestamp(seconds=0, microseconds=0),
+ offset=0,
+ negative_utc=False,
+ ),
+ type=RevisionType.GIT,
+ directory=hash_to_bytes("0000000000000000000000000000000000000000"),
+ synthetic=False,
+ metadata=None,
+ parents=(b"\x00" * 20,),
+ id=hash_to_bytes("1cfdff56457e2f1a86f53d8310e2e2bd92ad066c"),
+ extra_headers=(),
+ )
+
hg_revision = Revision(
id=hash_to_bytes("951c9503541e7beaf002d7aebf2abd1629084c68"),
message=b"hello",
diff --git a/swh/storage/tests/storage_tests.py b/swh/storage/tests/storage_tests.py
--- a/swh/storage/tests/storage_tests.py
+++ b/swh/storage/tests/storage_tests.py
@@ -1017,6 +1017,23 @@
("revision", revision2),
]
+ def test_revision_add_old(self, swh_storage, sample_data):
+ revision = sample_data.old_revision
+ init_missing = swh_storage.revision_missing([revision.id])
+ assert list(init_missing) == [revision.id]
+
+ actual_result = swh_storage.revision_add([revision])
+ assert actual_result == {"revision:add": 1}
+
+ end_missing = swh_storage.revision_missing([revision.id])
+ assert list(end_missing) == []
+
+ assert list(swh_storage.journal_writer.journal.objects) == [
+ ("revision", revision)
+ ]
+
+ assert swh_storage.revision_get([revision.id])[0] == revision
+
def test_revision_add_name_clash(self, swh_storage, sample_data):
revision, revision2 = sample_data.revisions[:2]
diff --git a/swh/storage/tests/test_postgresql.py b/swh/storage/tests/test_postgresql.py
--- a/swh/storage/tests/test_postgresql.py
+++ b/swh/storage/tests/test_postgresql.py
@@ -31,6 +31,13 @@
def test_directory_get_entries_pagination(self):
pass
+ @pytest.mark.xfail(
+ raises=AssertionError,
+ reason="PostgreSQL loses precision on very old timestamps.",
+ )
+ def test_revision_add_old(self, swh_storage, sample_data):
+ super().test_revision_add_old(swh_storage, sample_data)
+
@pytest.mark.db
class TestLocalStorage:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 2, 11:31 AM (6 d, 16 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220940
Attached To
D6819: Add test_revision_add_old, xfail on postgresql
Event Timeline
Log In to Comment