network: add hub registration, Redis persistence, and federated mesh join protocol
Some checks failed
Systemd Sync / sync-systemd (push) Waiting to run
CLI Tests / test-cli (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Documentation Validation / validate-docs (push) Has been cancelled
API Endpoint Tests / test-api-endpoints (push) Has been cancelled
Some checks failed
Systemd Sync / sync-systemd (push) Waiting to run
CLI Tests / test-cli (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Documentation Validation / validate-docs (push) Has been cancelled
API Endpoint Tests / test-api-endpoints (push) Has been cancelled
- Change default P2P port from 7070 to 8001 in config and .env.example - Add redis_url configuration option for hub persistence (default: redis://localhost:6379) - Implement DNS-based hub registration/unregistration via HTTPS API endpoints - Add Redis persistence for hub registrations with 1-hour TTL - Add island join request/response protocol with member list and blockchain credentials - Add GPU marketplace tracking (offers, bids, providers) in hub manager - Add
This commit is contained in:
@@ -21,17 +21,18 @@ class TestP2PDiscovery:
|
||||
|
||||
def test_generate_node_id(self):
|
||||
"""Test node ID generation"""
|
||||
hostname = "node1.example.com"
|
||||
address = "127.0.0.1"
|
||||
port = 8000
|
||||
public_key = "test_public_key"
|
||||
|
||||
node_id = self.discovery.generate_node_id(address, port, public_key)
|
||||
|
||||
|
||||
node_id = self.discovery.generate_node_id(hostname, address, port, public_key)
|
||||
|
||||
assert isinstance(node_id, str)
|
||||
assert len(node_id) == 64 # SHA256 hex length
|
||||
|
||||
|
||||
# Test consistency
|
||||
node_id2 = self.discovery.generate_node_id(address, port, public_key)
|
||||
node_id2 = self.discovery.generate_node_id(hostname, address, port, public_key)
|
||||
assert node_id == node_id2
|
||||
|
||||
def test_add_bootstrap_node(self):
|
||||
@@ -45,17 +46,18 @@ class TestP2PDiscovery:
|
||||
|
||||
def test_generate_node_id_consistency(self):
|
||||
"""Test node ID generation consistency"""
|
||||
hostname = "node2.example.com"
|
||||
address = "192.168.1.1"
|
||||
port = 9000
|
||||
public_key = "test_key"
|
||||
|
||||
node_id1 = self.discovery.generate_node_id(address, port, public_key)
|
||||
node_id2 = self.discovery.generate_node_id(address, port, public_key)
|
||||
|
||||
|
||||
node_id1 = self.discovery.generate_node_id(hostname, address, port, public_key)
|
||||
node_id2 = self.discovery.generate_node_id(hostname, address, port, public_key)
|
||||
|
||||
assert node_id1 == node_id2
|
||||
|
||||
|
||||
# Different inputs should produce different IDs
|
||||
node_id3 = self.discovery.generate_node_id("192.168.1.2", port, public_key)
|
||||
node_id3 = self.discovery.generate_node_id(hostname, "192.168.1.2", port, public_key)
|
||||
assert node_id1 != node_id3
|
||||
|
||||
def test_get_peer_count_empty(self):
|
||||
|
||||
Reference in New Issue
Block a user