Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
7b1252d6
Commit
7b1252d6
authored
May 26, 2018
by
juga
Browse files
Fix last_time by time and remove error_auth
parent
001b7e5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
sbws/lib/v3bwfile.py
View file @
7b1252d6
...
...
@@ -33,7 +33,7 @@ BW_KEYVALUE_SEP_V110 = ' '
BW_EXTRA_ARG_KEYVALUES
=
[
'master_key_ed25519'
,
'nick'
,
'rtt'
,
'time'
,
'success'
,
'error_stream'
,
'error_circ'
,
'error_misc'
]
BW_KEYVALUES_INT
=
[
'bw'
,
'rtt'
,
'success'
,
'error_auth'
,
'error_stream'
,
BW_KEYVALUES_INT
=
[
'bw'
,
'rtt'
,
'success'
,
'error_stream'
,
'error_circ'
,
'error_misc'
]
BW_KEYVALUES
=
[
'node_id'
,
'bw'
]
+
BW_EXTRA_ARG_KEYVALUES
...
...
tests/lib/data/v3bw.txt
View file @
7b1252d6
...
...
@@ -7,4 +7,4 @@ latest_bandwidth=2018-04-17T14:09:07
software=sbws
software_version=0.3.1-dev
====
bw=54
error_auth=0
error_circ=0 error_misc=0 error_stream=1
last_time=2018-04-17T14:09:07
nick=A node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA success=1
bw=54 error_circ=0 error_misc=0 error_stream=1 nick=A node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
rtt=456
success=1
time=2018-04-17T14:09:07
tests/unit/core/test_generate.py
View file @
7b1252d6
...
...
@@ -121,8 +121,8 @@ def test_generate_single_success_noscale(dotsbws_success_result, caplog,
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
,
last_
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
1
,
error_circ
=
0
,
error_auth
=
0
,
error_misc
=
0
,
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
1
,
error_circ
=
0
,
error_misc
=
0
,
error_stream
=
0
)
# bw_line = V3BWLine.from_results(results)
print
(
stdout_lines
)
...
...
@@ -155,8 +155,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
,
last_
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
1
,
error_circ
=
0
,
error_auth
=
0
,
error_misc
=
0
,
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
1
,
error_circ
=
0
,
error_misc
=
0
,
error_stream
=
0
)
assert
stdout_lines
[
NUM_LINES_HEADER_V110
]
+
'
\n
'
==
str
(
bw_line
)
...
...
@@ -193,8 +193,8 @@ def test_generate_single_relay_success_noscale(
unixts_to_isodt_str
(
round
(
result
.
time
)))
bw_line
=
V3BWLine
(
result
.
fingerprint
,
speed
,
nick
=
result
.
nickname
,
rtt
=
rtt
,
last_
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
2
,
error_circ
=
0
,
error_auth
=
0
,
error_misc
=
0
,
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
2
,
error_circ
=
0
,
error_misc
=
0
,
error_stream
=
0
)
assert
stdout_lines
[
NUM_LINES_HEADER_V110
]
+
'
\n
'
==
str
(
bw_line
)
...
...
@@ -226,8 +226,8 @@ def test_generate_single_relay_success_scale(
rtt
=
round
(
median
([
round
(
r
*
1000
)
for
r
in
result
.
rtts
]))
bw_line
=
V3BWLine
(
result
.
fingerprint
,
speed
,
nick
=
result
.
nickname
,
rtt
=
rtt
,
last_
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
2
,
error_circ
=
0
,
error_auth
=
0
,
error_misc
=
0
,
time
=
unixts_to_isodt_str
(
round
(
result
.
time
)),
success
=
2
,
error_circ
=
0
,
error_misc
=
0
,
error_stream
=
0
)
assert
stdout_lines
[
NUM_LINES_HEADER_V110
]
+
'
\n
'
==
str
(
bw_line
)
...
...
@@ -265,8 +265,8 @@ def test_generate_two_relays_success_noscale(
r1_rtt
=
round
(
median
([
round
(
rtt
*
1000
)
for
r
in
r1_results
for
rtt
in
r
.
rtts
]))
bw_line
=
V3BWLine
(
r1_fingerprint
,
r1_speed
,
nick
=
r1_name
,
rtt
=
r1_rtt
,
last_
time
=
r1_time
,
success
=
2
,
error_circ
=
0
,
error_auth
=
0
,
error_misc
=
0
,
time
=
r1_time
,
success
=
2
,
error_circ
=
0
,
error_misc
=
0
,
error_stream
=
0
)
assert
stdout_lines
[
1
+
NUM_LINES_HEADER_V110
]
+
'
\n
'
==
str
(
bw_line
)
...
...
@@ -280,7 +280,7 @@ def test_generate_two_relays_success_noscale(
r2_rtt
=
round
(
median
([
round
(
rtt
*
1000
)
for
r
in
r2_results
for
rtt
in
r
.
rtts
]))
bw_line
=
V3BWLine
(
r2_fingerprint
,
r2_speed
,
nick
=
r2_name
,
rtt
=
r2_rtt
,
last_
time
=
r2_time
,
success
=
2
,
error_circ
=
0
,
error_auth
=
0
,
error_misc
=
0
,
time
=
r2_time
,
success
=
2
,
error_circ
=
0
,
error_misc
=
0
,
error_stream
=
0
)
assert
stdout_lines
[
NUM_LINES_HEADER_V110
]
+
'
\n
'
==
str
(
bw_line
)
tests/unit/lib/test_v3bwfile.py
View file @
7b1252d6
...
...
@@ -34,9 +34,10 @@ header_extra_ls = [timestamp_l, version_l,
software_l
,
software_version_l
,
TERMINATOR
]
header_extra_str
=
LINE_SEP
.
join
(
header_extra_ls
)
+
LINE_SEP
bwl_str
=
"bw=54 error_auth=0 error_circ=0 error_misc=0 error_stream=1 "
\
"last_time=2018-04-17T14:09:07 nick=A "
\
"node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA success=1
\n
"
bwl_str
=
"bw=54 error_circ=0 error_misc=0 error_stream=1 "
\
"nick=A "
\
"node_id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA rtt=456 success=1 "
\
"time=2018-04-17T14:09:07
\n
"
v3bw_str
=
header_extra_str
+
bwl_str
...
...
@@ -161,5 +162,4 @@ def test_v3bwfile(datadir, tmpdir):
bwls
=
[
V3BWLine
.
from_results
(
results
[
fp
])
for
fp
in
results
]
f
=
V3BwFile
(
header
,
bwls
)
# f = V3BwFile.from_results(None, str(tmpdir.join("v3bw.txt")), results)
assert
v3bw
==
str
(
f
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment