Skip to content

Commit

Permalink
add a big-value performance test for sftp
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWaldmann committed Aug 2, 2024
1 parent d0dddcb commit db434fe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def posixfs_backend(tmp_path):
def get_sftp_backend():
# needs an authorized key loaded into the ssh agent. pytest works, tox doesn't:
return Sftp(username="tw", hostname="localhost", path="/Users/tw/w/borgstore/temp-store")
# for tests with higher latency:
# return Sftp(
# username="twaldmann", hostname="shell.ipv4.thinkmo.de", port=2222, path="/home/twaldmann/borgstore/temp-store"
# )


def check_sftp_available():
Expand Down
16 changes: 15 additions & 1 deletion tests/test_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest

from . import key, list_store_names
from .test_backends import posixfs_backend # noqa
from .test_backends import posixfs_backend, sftp_backend, sftp_is_available # noqa

from borgstore.constants import ROOTNS
from borgstore.store import Store, ItemInfo
Expand Down Expand Up @@ -63,6 +63,20 @@ def test_scalability_count(posixfs_backend, levels, count):
assert list_store_names(store, ROOTNS) == keys


@pytest.mark.skipif(not sftp_is_available, reason="SFTP is not available")
def test_scalability_big_values(sftp_backend):
levels = {ROOTNS: [0]}
count = 10
value = b"x" * 2**20
store = Store(backend=sftp_backend, levels=levels)
keys = [key(i) for i in range(count)]
for k in keys:
store.store(k, value)
for k in keys:
assert store.load(k) == value
assert list_store_names(store, ROOTNS) == keys


def test_file_url(tmp_path):
from borgstore.backends.posixfs import PosixFS

Expand Down

0 comments on commit db434fe

Please sign in to comment.