Commit a9b0f03c authored by juga's avatar juga Committed by Matt Traudt
Browse files

Add forgotten "$" at the beginning of node_id value

parent 4086f4d1
......@@ -253,6 +253,7 @@ class V3BWLine(object):
def __init__(self, node_id, bw, **kwargs):
assert isinstance(node_id, str)
assert isinstance(bw, int)
assert node_id.startswith('$')
self.node_id = node_id
self.bw = bw
[setattr(self, k, v) for k, v in kwargs.items()
......@@ -332,7 +333,7 @@ class V3BWLine(object):
def from_results(cls, results):
success_results = [r for r in results if isinstance(r, ResultSuccess)]
# log.debug('len(success_results) %s', len(success_results))
node_id = results[0].fingerprint
node_id = '$' + results[0].fingerprint
bw = cls.bw_from_results(success_results)
kwargs = dict()
kwargs['nick'] = results[0].nickname
......
......@@ -116,7 +116,8 @@ def test_generate_single_success_noscale(dotsbws_success_result, caplog,
bw = round(median([dl['amount'] / dl['duration'] / 1024
for dl in result.downloads]))
rtt = median([round(r * 1000) for r in result.rtts])
bw_line = V3BWLine(result.fingerprint, bw, nick=result.nickname, rtt=rtt,
bw_line = V3BWLine('$' + result.fingerprint, bw, nick=result.nickname,
rtt=rtt,
time=unixts_to_isodt_str(round(result.time)),
master_key_ed25519=result.master_key_ed25519,
success=1, error_circ=0, error_misc=0,
......@@ -149,7 +150,8 @@ def test_generate_single_success_scale(dotsbws_success_result, parser,
bw = 7500
rtt = median([round(r * 1000) for r in result.rtts])
bw_line = V3BWLine(result.fingerprint, bw, nick=result.nickname, rtt=rtt,
bw_line = V3BWLine('$' + result.fingerprint, bw, nick=result.nickname,
rtt=rtt,
time=unixts_to_isodt_str(round(result.time)),
master_key_ed25519=result.master_key_ed25519,
success=1, error_circ=0, error_misc=0,
......@@ -184,7 +186,7 @@ def test_generate_single_relay_success_noscale(
for r in results for dl in r.downloads]
speed = round(median(speeds))
rtt = round(median([round(r * 1000) for r in result.rtts]))
bw_line = V3BWLine(result.fingerprint, speed, nick=result.nickname,
bw_line = V3BWLine('$' + result.fingerprint, speed, nick=result.nickname,
rtt=rtt, master_key_ed25519=result.master_key_ed25519,
time=unixts_to_isodt_str(round(result.time)),
success=2, error_circ=0, error_misc=0,
......@@ -217,7 +219,7 @@ def test_generate_single_relay_success_scale(
speed = 7500
rtt = round(median([round(r * 1000) for r in result.rtts]))
bw_line = V3BWLine(result.fingerprint, speed, nick=result.nickname,
bw_line = V3BWLine('$' + result.fingerprint, speed, nick=result.nickname,
rtt=rtt,
master_key_ed25519=result.master_key_ed25519,
time=unixts_to_isodt_str(round(result.time)),
......@@ -252,7 +254,7 @@ def test_generate_two_relays_success_noscale(
r1_results = [r for r in results if r.fingerprint == 'A' * 40]
r1_time = unixts_to_isodt_str(round(max([r.time for r in r1_results])))
r1_name = r1_results[0].nickname
r1_fingerprint = r1_results[0].fingerprint
r1_fingerprint = '$' + r1_results[0].fingerprint
r1_ed25519 = r1_results[0].master_key_ed25519
r1_speeds = [dl['amount'] / dl['duration'] / 1024
for r in r1_results for dl in r.downloads]
......@@ -268,7 +270,7 @@ def test_generate_two_relays_success_noscale(
r2_results = [r for r in results if r.fingerprint == 'B' * 40]
r2_time = unixts_to_isodt_str(round(max([r.time for r in r2_results])))
r2_name = r2_results[0].nickname
r2_fingerprint = r2_results[0].fingerprint
r2_fingerprint = '$' + r2_results[0].fingerprint
r2_ed25519 = r2_results[0].master_key_ed25519
r2_speeds = [dl['amount'] / dl['duration'] / 1024
for r in r2_results for dl in r.downloads]
......
......@@ -7,4 +7,4 @@ latest_bandwidth=2018-04-17T14:09:07
software=sbws
software_version=0.4.1-dev
====
bw=54 error_circ=0 error_misc=0 error_stream=1 master_key_ed25519=g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s nick=A node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 time=2018-04-17T14:09:07
bw=54 error_circ=0 error_misc=0 error_stream=1 master_key_ed25519=g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s nick=A node_id=$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 time=2018-04-17T14:09:07
......@@ -37,7 +37,7 @@ header_extra_str = LINE_SEP.join(header_extra_ls) + LINE_SEP
bwl_str = "bw=54 error_circ=0 error_misc=0 error_stream=1 " \
"master_key_ed25519=g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s " \
"nick=A " \
"node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 " \
"node_id=$AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 " \
"time=2018-04-17T14:09:07\n"
v3bw_str = header_extra_str + bwl_str
......
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