commit 90df22e4cf8b27ad85117012404698a06fe80f26 Author: juga0 juga@riseup.net Date: Fri Nov 23 10:38:59 2018 +0000
tests: decrease bandwidth burst in results
To test that torflow's scaling is using the minimum of all the descriptor bandwidth values. --- tests/unit/lib/data/results.txt | 2 +- tests/unit/lib/test_v3bwfile.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/unit/lib/data/results.txt b/tests/unit/lib/data/results.txt index b8f4e14..9bb4909 100644 --- a/tests/unit/lib/data/results.txt +++ b/tests/unit/lib/data/results.txt @@ -1,2 +1,2 @@ -{"version": 4, "time": 1523887747, "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"], "type": "success", "rtts": [0.4596822261810303, 0.44872617721557617, 0.4563450813293457, 0.44872212409973145, 0.4561030864715576, 0.4765200614929199, 0.4495084285736084, 0.45711588859558105, 0.45520496368408203, 0.4635589122772217], "fingerprint": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "scanner": "IDidntEditTheSBWSConfig", "downloads": [{"amount": 590009, "duration": 6.1014368534088135}, {"amount": 590009, "duration": 8.391342878341675}, {"amount": 321663, "duration": 7.064587831497192}, {"amount": 321663, "duration": 8.266003131866455}, {"amount": 321663, "duration": 5.779450178146362}], "dest_url": "http://y.z", "nickname": "A", "address": "111.111.111.111", "master_key_ed25519": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s", "relay_average_bandwidth": 1000000000, "relay_burst_bandwidth": 1000000000, "relay_observed_bandwidth": 524288} +{"version": 4, "time": 1523887747, "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"], "type": "success", "rtts": [0.4596822261810303, 0.44872617721557617, 0.4563450813293457, 0.44872212409973145, 0.4561030864715576, 0.4765200614929199, 0.4495084285736084, 0.45711588859558105, 0.45520496368408203, 0.4635589122772217], "fingerprint": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "scanner": "IDidntEditTheSBWSConfig", "downloads": [{"amount": 590009, "duration": 6.1014368534088135}, {"amount": 590009, "duration": 8.391342878341675}, {"amount": 321663, "duration": 7.064587831497192}, {"amount": 321663, "duration": 8.266003131866455}, {"amount": 321663, "duration": 5.779450178146362}], "dest_url": "http://y.z", "nickname": "A", "address": "111.111.111.111", "master_key_ed25519": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s", "relay_average_bandwidth": 1000000000, "relay_burst_bandwidth": 123456, "relay_observed_bandwidth": 524288} {"version": 4, "time": 1523974147, "circ": ["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"], "type": "error-stream", "msg": "Something bad happened while measuring bandwidth", "fingerprint": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "scanner": "IDidntEditTheSBWSConfig", "dest_url": "http://y.z", "nickname": "A", "address": "111.111.111.111", "master_key_ed25519": "g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s"} diff --git a/tests/unit/lib/test_v3bwfile.py b/tests/unit/lib/test_v3bwfile.py index 3f3bded..da2c8d8 100644 --- a/tests/unit/lib/test_v3bwfile.py +++ b/tests/unit/lib/test_v3bwfile.py @@ -40,7 +40,7 @@ header_extra_str = LINE_SEP.join(header_extra_ls) + LINE_SEP
# Line produced without any scaling. raw_bwl_str = "bw=56 bw_mean=61423 bw_median=55656 "\ - "desc_bw_avg=1000000000 desc_bw_bur=1000000000 desc_bw_obs_last=524288 "\ + "desc_bw_avg=1000000000 desc_bw_bur=123456 desc_bw_obs_last=524288 "\ "desc_bw_obs_mean=524288 error_circ=0 error_misc=0 error_stream=1 " \ "master_key_ed25519=g+Shk00y9Md0hg1S6ptnuc/wWKbADBgdjT0Kg+TSF3s " \ "nick=A " \ @@ -267,13 +267,13 @@ def test_sbws_scale(datadir): def test_torflow_scale(datadir): results = load_result_file(str(datadir.join("results.txt"))) v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING) - assert v3bwfile.bw_lines[0].bw == 520 + assert v3bwfile.bw_lines[0].bw == 120 v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING, torflow_cap=0.0001) - assert v3bwfile.bw_lines[0].bw == 520 + assert v3bwfile.bw_lines[0].bw == 120 v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING, torflow_cap=1, torflow_round_digs=1) - assert v3bwfile.bw_lines[0].bw == 500 + assert v3bwfile.bw_lines[0].bw == 100
def test_results_away_each_other(datadir):