mirror of
https://github.com/beshu-tech/deltaglider.git
synced 2026-04-19 15:01:23 +02:00
Initial commit: DeltaGlider - S3-compatible storage with 99.9% compression
- Drop-in replacement for AWS S3 CLI (cp, ls, rm, sync commands) - Binary delta compression using xdelta3 - Hexagonal architecture with clean separation of concerns - Achieves 99.9% compression for versioned files - Full test suite with 100% passing tests - Python 3.11+ support
This commit is contained in:
@@ -41,6 +41,7 @@ class TestSha256Adapter:
|
||||
# Execute
|
||||
adapter = Sha256Adapter()
|
||||
import io
|
||||
|
||||
stream = io.BytesIO(content)
|
||||
actual = adapter.sha256(stream)
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ class TestDeltaServicePut:
|
||||
|
||||
# Create reference content and compute its SHA
|
||||
import io
|
||||
|
||||
ref_content = b"reference content for test"
|
||||
ref_sha = service.hasher.sha256(io.BytesIO(ref_content))
|
||||
|
||||
@@ -92,6 +93,7 @@ class TestDeltaServicePut:
|
||||
|
||||
# Create reference content and compute its SHA
|
||||
import io
|
||||
|
||||
ref_content = b"reference content for test"
|
||||
ref_sha = service.hasher.sha256(io.BytesIO(ref_content))
|
||||
|
||||
@@ -158,6 +160,7 @@ class TestDeltaServiceGet:
|
||||
|
||||
# Execute and verify
|
||||
from deltaglider.core.errors import StorageIOError
|
||||
|
||||
with pytest.raises(StorageIOError):
|
||||
service.get(delta_key, temp_dir / "output.zip")
|
||||
|
||||
@@ -178,6 +181,7 @@ class TestDeltaServiceVerify:
|
||||
|
||||
# Create reference content for mock
|
||||
import io
|
||||
|
||||
ref_content = b"reference content for test"
|
||||
ref_sha = service.hasher.sha256(io.BytesIO(ref_content))
|
||||
|
||||
@@ -212,11 +216,13 @@ class TestDeltaServiceVerify:
|
||||
else:
|
||||
# Default case - return reference content
|
||||
return io.BytesIO(ref_content)
|
||||
|
||||
mock_storage.get.side_effect = get_side_effect
|
||||
|
||||
# Setup mock diff decode to create correct file
|
||||
def decode_correct(base, delta, out):
|
||||
out.write_bytes(test_content)
|
||||
|
||||
mock_diff.decode.side_effect = decode_correct
|
||||
|
||||
# Create cached reference
|
||||
@@ -232,4 +238,3 @@ class TestDeltaServiceVerify:
|
||||
assert result.expected_sha256 == test_sha
|
||||
assert result.actual_sha256 == test_sha
|
||||
assert "verified" in result.message.lower()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user