Skip to content
Snippets Groups Projects
Commit afd69e94 authored by zphrs's avatar zphrs
Browse files

fixed basic_proxy_partitioned_shards; added more logging for rebroadcast

parent f4b70e46
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,8 @@ class KVSTestFixture:
def rebroadcast_view(self, new_view: Dict[str, List[Dict[str, Any]]]):
for i, client in enumerate(self.clients):
r = client.resend_last_view_with_ips_from_new_view(new_view)
self.log("rebroadcasting view for node {i}")
r = client.resend_last_view_with_ips_from_new_view(new_view, self.log)
if r is None:
return
assert r.status_code == 200, (
......
......@@ -76,8 +76,8 @@ def basic_proxy_partitioned_shards(
c = KVSMultiClient(fx.clients, "client", log)
conductor.add_shard("shard1", conductor.get_nodes([0, 1]))
conductor.add_shard("shard2", conductor.get_nodes([2, 3]))
conductor.create_partition([2, 3], "secondshard")
fx.broadcast_view(conductor.get_shard_view())
conductor.create_partition([2, 3], "secondshard")
helper(c, timeout=timeout)
return True, "ok"
......
from logging import Logger
import requests
from typing import Dict, Any, List
import aiohttp
......@@ -155,6 +156,7 @@ class KVSClient:
def resend_last_view_with_ips_from_new_view(
self,
current_view: dict[str, List[Dict[str, Any]]],
log: Logger,
timeout: float = DEFAULT_TIMEOUT,
) -> requests.Response:
if not isinstance(current_view, dict):
......@@ -172,5 +174,5 @@ class KVSClient:
node["address"] = flattened_current_view[node["id"]]
request_body = {"view": self.last_view}
print(f"Sending new view: {self.last_view}")
log(f"Sending new view: {self.last_view}")
return requests.put(f"{self.base_url}/view", json=request_body, timeout=timeout)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment