Commit 127cf46c authored by juga's avatar juga
Browse files

new: tests: Update header and lines with new KeyValues

Part of #28565.
parent f5e611c2
......@@ -8,9 +8,12 @@ from sbws import __version__ as version
from sbws.globals import (SPEC_VERSION, SBWS_SCALING, TORFLOW_SCALING,
MIN_REPORT, TORFLOW_ROUND_DIG, PROP276_ROUND_DIG)
from sbws.lib.resultdump import Result, load_result_file, ResultSuccess
from sbws.lib.v3bwfile import (V3BWHeader, V3BWLine, TERMINATOR, LINE_SEP,
KEYVALUE_SEP_V1, num_results_of_type,
V3BWFile, round_sig_dig)
from sbws.lib.v3bwfile import (
V3BWHeader, V3BWLine, TERMINATOR, LINE_SEP,
KEYVALUE_SEP_V1, num_results_of_type,
V3BWFile, round_sig_dig,
BW_HEADER_KEYVALUES_RECENT_MEASUREMENTS_EXCLUDED
)
from sbws.util.timestamp import now_fname, now_isodt_str, now_unixts
timestamp = 1523974147
......@@ -238,7 +241,7 @@ def test_v3bwline_from_results_file(datadir):
if fp not in d:
d[fp] = []
d[fp].append(r)
bwl = V3BWLine.from_data(d, fp)
bwl, _ = V3BWLine.from_data(d, fp)
# bw store now B, not KB
bwl.bw = round(bwl.bw / 1000)
assert raw_bwl_str == str(bwl)
......@@ -249,7 +252,11 @@ def test_from_results_read(datadir, tmpdir, conf, args):
expected_header = V3BWHeader(timestamp_l,
earliest_bandwidth=earliest_bandwidth,
latest_bandwidth=latest_bandwidth)
raw_bwls = [V3BWLine.from_results(results[fp]) for fp in results]
exclusion_dict = dict(
[(k, 0) for k in BW_HEADER_KEYVALUES_RECENT_MEASUREMENTS_EXCLUDED]
)
expected_header.add_relays_excluded_counters(exclusion_dict)
raw_bwls = [V3BWLine.from_results(results[fp])[0] for fp in results]
# Scale BWLines using torflow method, since it's the default and BWLines
# bandwidth is the raw bandwidth.
expected_bwls = V3BWFile.bw_torflow_scale(raw_bwls)
......@@ -366,7 +373,7 @@ def test_measured_progress_stats(datadir):
results = load_result_file(str(datadir.join("results_away.txt")))
for fp, values in results.items():
# log.debug("Relay fp %s", fp)
line = V3BWLine.from_results(values)
line, _ = V3BWLine.from_results(values)
if line is not None:
bw_lines_raw.append(line)
assert len(bw_lines_raw) == 3
......
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