mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-07-09 13:58:07 +02:00
release: prepare v0.9.7
This commit is contained in:
@@ -52,6 +52,7 @@ def test_refresh_node_peer_store_promotes_manifest_peers_to_sync_only(tmp_path,
|
||||
monkeypatch.setenv("MESH_BOOTSTRAP_SIGNER_PUBLIC_KEY", manifest_pub)
|
||||
monkeypatch.setenv("MESH_BOOTSTRAP_MANIFEST_PATH", str(manifest_path))
|
||||
monkeypatch.setenv("MESH_RELAY_PEERS", "https://operator.example")
|
||||
monkeypatch.setenv("MESH_DEFAULT_SYNC_PEERS", "")
|
||||
get_settings.cache_clear()
|
||||
|
||||
try:
|
||||
@@ -73,6 +74,39 @@ def test_refresh_node_peer_store_promotes_manifest_peers_to_sync_only(tmp_path,
|
||||
assert [record.peer_url for record in store.records_for_bucket("push")] == ["https://operator.example"]
|
||||
|
||||
|
||||
def test_refresh_node_peer_store_adds_default_seed_as_pull_only_peer(tmp_path, monkeypatch):
|
||||
import main
|
||||
from services.config import get_settings
|
||||
from services.mesh import mesh_peer_store as peer_store_mod
|
||||
|
||||
peer_store_path = tmp_path / "peer_store.json"
|
||||
monkeypatch.setattr(peer_store_mod, "DEFAULT_PEER_STORE_PATH", peer_store_path)
|
||||
monkeypatch.setenv("MESH_RELAY_PEERS", "")
|
||||
monkeypatch.setenv("MESH_DEFAULT_SYNC_PEERS", "https://node.shadowbroker.info")
|
||||
monkeypatch.setenv("MESH_BOOTSTRAP_SIGNER_PUBLIC_KEY", "")
|
||||
get_settings.cache_clear()
|
||||
|
||||
try:
|
||||
snapshot = main._refresh_node_peer_store(now=1_750_000_000)
|
||||
store = peer_store_mod.PeerStore(peer_store_path)
|
||||
store.load()
|
||||
finally:
|
||||
get_settings.cache_clear()
|
||||
|
||||
assert snapshot["manifest_loaded"] is False
|
||||
assert snapshot["default_sync_peer_count"] == 1
|
||||
assert snapshot["bootstrap_peer_count"] == 1
|
||||
assert snapshot["sync_peer_count"] == 1
|
||||
assert snapshot["push_peer_count"] == 0
|
||||
assert [record.peer_url for record in store.records_for_bucket("bootstrap")] == [
|
||||
"https://node.shadowbroker.info"
|
||||
]
|
||||
assert [record.peer_url for record in store.records_for_bucket("sync")] == [
|
||||
"https://node.shadowbroker.info"
|
||||
]
|
||||
assert store.records_for_bucket("sync")[0].source == "bundle"
|
||||
|
||||
|
||||
def test_verify_peer_push_hmac_requires_allowlisted_peer(monkeypatch):
|
||||
import hashlib
|
||||
import hmac
|
||||
@@ -134,3 +168,19 @@ def test_infonet_status_includes_node_runtime_snapshot(monkeypatch):
|
||||
assert result["bootstrap"]["push_peer_count"] == 1
|
||||
assert result["sync_runtime"]["last_outcome"] == "ok"
|
||||
assert result["push_runtime"]["last_event_id"] == "evt-1"
|
||||
|
||||
|
||||
def test_public_sync_cycle_allows_first_node_without_peers(tmp_path, monkeypatch):
|
||||
import main
|
||||
from services.mesh import mesh_peer_store as peer_store_mod
|
||||
|
||||
peer_store_path = tmp_path / "peer_store.json"
|
||||
monkeypatch.setattr(peer_store_mod, "DEFAULT_PEER_STORE_PATH", peer_store_path)
|
||||
monkeypatch.setattr(main, "_participant_node_enabled", lambda: True)
|
||||
|
||||
result = main._run_public_sync_cycle()
|
||||
|
||||
assert result.last_outcome == "solo"
|
||||
assert result.last_error == ""
|
||||
assert result.last_peer_url == ""
|
||||
assert result.consecutive_failures == 0
|
||||
|
||||
Reference in New Issue
Block a user