Commit 2cff7083 authored by juga's avatar juga
Browse files

Rename scanner_started to tenerator_started

parent 8b84838e
......@@ -106,8 +106,8 @@ def read_started_ts(conf):
"""
with open(os.path.join(conf['paths']['datadir'],
conf['scanner']['started_filepath']), 'r') as fd:
scanner_started_ts = fd.read()
return scanner_started_ts
generator_started = fd.read()
return generator_started
def main(args, conf):
......@@ -132,12 +132,12 @@ def main(args, conf):
data_lines = [result_data_to_v3bw_line(results, fp) for fp in results]
data_lines = sorted(data_lines, key=lambda d: d.bw, reverse=True)
data_lines = scale_lines(args, data_lines)
scanner_started_ts = read_started_ts(conf)
generator_started = read_started_ts(conf)
if results:
header = V3BwHeader(earliest_bandwidth=earliest_bandwidth,
scanner_started_ts=scanner_started_ts)
generator_started=generator_started)
else:
header = V3BwHeader(scanner_started_ts=scanner_started_ts)
header = V3BwHeader(generator_started=generator_started)
log_stats(data_lines)
output = conf['paths']['v3bw_fname']
if args.output:
......
......@@ -283,11 +283,11 @@ def write_start_ts(conf):
:param ConfigParser conf: configuration
"""
scanner_started_ts = str(time.time())
log.info('Scanner started at {}'.format(scanner_started_ts))
generator_started = str(time.time())
log.info('Scanner started at {}'.format(generator_started))
with open(os.path.join(conf['paths']['datadir'],
conf['scanner']['started_filepath']), 'wt') as fd:
fd.write(scanner_started_ts)
fd.write(generator_started)
def run_speedtest(args, conf):
......
......@@ -29,8 +29,8 @@ class V3BwHeader(object):
self.software_version = software_version
if kwargs.get('earliest_bandwidth'):
self.earliest_bandwidth = kwargs['earliest_bandwidth']
if kwargs.get('scanner_started_ts'):
self.scanner_started = kwargs['scanner_started_ts']
if kwargs.get('generator_started'):
self.scanner_started = kwargs['generator_started']
def __str__(self):
......
......@@ -25,8 +25,8 @@ def test_v3bwheader_earliest_bandwidth_str():
def test_v3bwheader_scanner_started_str():
"""Test header str with scanner_started"""
timestamp = 1524661857
scanner_started_ts = 1523887747.2904038
header = V3BwHeader(timestamp, scanner_started_ts=scanner_started_ts)
generator_started = 1523887747.2904038
header = V3BwHeader(timestamp, generator_started=generator_started)
assert str(header) == '{}\nscanner_started=1523887747.2904038' \
'{}\nversion=1.1.0\nsoftware=sbws\n' \
'software_version={}\n'.format(timestamp, version)
......@@ -42,15 +42,6 @@ def test_v3bwheader_earliest_bandwidth_str():
'timestamp=1524661857 version=1.1.0\n'.format(timestamp)
def test_v3bwheader_scanner_started_str():
"""Test header str with scanner_started"""
timestamp = 1524661857
scanner_started_ts = 1523887747.2904038
header = V3BwHeader(timestamp, scanner_started_ts=scanner_started_ts)
assert str(header) == '{}\nscanner_started=1523887747.2904038 ' \
'software=sbws software_version=0.1.0 ' \
'timestamp=1524661857 version=1.1.0\n'.format(timestamp)
def test_v3bwfile():
"""Test generate v3bw file (including relay_lines)."""
pass
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