Commit 51ce3cba authored by juga's avatar juga
Browse files

chg: Change `cc_alg` and `bwscanner_cc` values to int

Because consensus parameters are strings in stem.

Closes #40134.
parent 1093dfc3
Pipeline #37557 failed with stages
in 18 minutes and 24 seconds
......@@ -563,7 +563,7 @@ class RelayList:
# Create a dictionary from the consensus `params` line.
self.consensus_params_dict = dict(
[
(p.split("=")[0], p.split("=")[1])
(p.split("=")[0], int(p.split("=")[1]))
for p in consensus_dict.get("params", [])
]
)
......@@ -589,7 +589,7 @@ class RelayList:
"""
if (
self.consensus_params_dict
and self.consensus_params_dict.get("cc_alg", None) == 2
and self.consensus_params_dict.get("cc_alg", 0) == 2
):
log.info("The consensus implements congestion control.")
return True
......@@ -603,7 +603,7 @@ class RelayList:
the `bwscanner_cc` field."""
if (
self.consensus_params_dict
and self.consensus_params_dict.get("bwscanner_cc", None) >= 1
and self.consensus_params_dict.get("bwscanner_cc", 0) >= 1
):
log.info(
"The consensus says to use exits that support congestion"
......
......@@ -79,7 +79,7 @@ def router_statuses_5days_later(root_data_path):
@pytest.fixture(scope="session")
def controller(router_statuses):
controller = mock.Mock()
controller.get_info.return_value = "params foo=bar"
controller.get_info.return_value = "params foo=23"
controller.get_network_statuses.return_value = router_statuses
return controller
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment