mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-10 08:19:23 +00:00
Throttle Nostr index size test
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
@@ -18,6 +19,7 @@ from nostr.client import NostrClient, Kind, KindStandard
|
|||||||
|
|
||||||
@pytest.mark.desktop
|
@pytest.mark.desktop
|
||||||
@pytest.mark.network
|
@pytest.mark.network
|
||||||
|
@pytest.mark.skipif(not os.getenv("NOSTR_E2E"), reason="NOSTR_E2E not set")
|
||||||
def test_nostr_index_size_limits():
|
def test_nostr_index_size_limits():
|
||||||
"""Manually explore maximum index size for Nostr backups."""
|
"""Manually explore maximum index size for Nostr backups."""
|
||||||
seed = (
|
seed = (
|
||||||
@@ -38,6 +40,7 @@ def test_nostr_index_size_limits():
|
|||||||
entry_mgr = EntryManager(vault, Path(tmpdir))
|
entry_mgr = EntryManager(vault, Path(tmpdir))
|
||||||
|
|
||||||
sizes = [16, 64, 256, 1024, 2048, 4096, 8192]
|
sizes = [16, 64, 256, 1024, 2048, 4096, 8192]
|
||||||
|
delay = float(os.getenv("NOSTR_TEST_DELAY", "5"))
|
||||||
for size in sizes:
|
for size in sizes:
|
||||||
try:
|
try:
|
||||||
entry_mgr.add_entry(
|
entry_mgr.add_entry(
|
||||||
@@ -49,7 +52,7 @@ def test_nostr_index_size_limits():
|
|||||||
encrypted = vault.get_encrypted_index()
|
encrypted = vault.get_encrypted_index()
|
||||||
payload_size = len(encrypted) if encrypted else 0
|
payload_size = len(encrypted) if encrypted else 0
|
||||||
published = client.publish_json_to_nostr(encrypted or b"")
|
published = client.publish_json_to_nostr(encrypted or b"")
|
||||||
time.sleep(2)
|
time.sleep(delay)
|
||||||
retrieved = client.retrieve_json_from_nostr_sync()
|
retrieved = client.retrieve_json_from_nostr_sync()
|
||||||
retrieved_ok = retrieved == encrypted
|
retrieved_ok = retrieved == encrypted
|
||||||
results.append((size, payload_size, published, retrieved_ok))
|
results.append((size, payload_size, published, retrieved_ok))
|
||||||
|
Reference in New Issue
Block a user