Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbws
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
juga
sbws
Commits
8e650d83
Commit
8e650d83
authored
7 years ago
by
Matt Traudt
Committed by
Matt Traudt
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Change bw values in v3bw file to be in KiB
GH: closes #97
parent
66de536b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sbws/core/generate.py
+1
-1
1 addition, 1 deletion
sbws/core/generate.py
tests/conftest.py
+7
-7
7 additions, 7 deletions
tests/conftest.py
tests/core/test_generate.py
+7
-7
7 additions, 7 deletions
tests/core/test_generate.py
with
15 additions
and
15 deletions
sbws/core/generate.py
+
1
−
1
View file @
8e650d83
...
...
@@ -34,7 +34,7 @@ def result_data_to_v3bw_line(data, fingerprint):
assert
isinstance
(
res
,
ResultSuccess
)
results
=
data
[
fingerprint
]
nick
=
results
[
0
].
nickname
speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
/
1024
for
r
in
results
for
dl
in
r
.
downloads
]
speed
=
median
(
speeds
)
rtts
=
[
rtt
for
r
in
results
for
rtt
in
r
.
rtts
]
...
...
This diff is collapsed.
Click to expand it.
tests/conftest.py
+
7
−
7
View file @
8e650d83
...
...
@@ -93,7 +93,7 @@ def dotsbws_success_result(empty_dotsbws_datadir):
server_ip
=
'
169.254.100.2
'
scanner_nick
=
'
SBWSscanner
'
rtts
=
[
4.242
]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
40
}]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
40
*
1024
}]
t
=
time
.
time
()
relay
=
Result
.
Relay
(
fp1
,
nick
,
relay_ip
)
result
=
ResultSuccess
(
rtts
,
downloads
,
relay
,
circ
,
server_ip
,
...
...
@@ -121,7 +121,7 @@ def dotsbws_success_result_one_relay(empty_dotsbws_datadir):
server_ip
=
'
169.254.100.2
'
scanner_nick
=
'
SBWSscanner
'
rtts
=
[
5
,
25
]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
40
}]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
40
*
1024
}]
t
=
time
.
time
()
relay
=
Result
.
Relay
(
fp1
,
nick
,
relay_ip
)
result
=
ResultSuccess
(
rtts
,
downloads
,
relay
,
circ
,
server_ip
,
...
...
@@ -129,7 +129,7 @@ def dotsbws_success_result_one_relay(empty_dotsbws_datadir):
write_result_to_datadir
(
result
,
dd
)
rtts
=
[
10
,
20
]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
80
}]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
80
*
1024
}]
t
=
time
.
time
()
result
=
ResultSuccess
(
rtts
,
downloads
,
relay
,
circ
,
server_ip
,
scanner_nick
,
t
=
t
)
...
...
@@ -154,7 +154,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
server_ip
=
'
169.254.100.3
'
scanner_nick
=
'
SBWSscanner
'
rtts
=
[
5
,
25
]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
40
}]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
40
*
1024
}]
t
=
time
.
time
()
relay
=
Result
.
Relay
(
fp1
,
nick
,
relay_ip
)
result
=
ResultSuccess
(
rtts
,
downloads
,
relay
,
circ
,
server_ip
,
...
...
@@ -162,7 +162,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
write_result_to_datadir
(
result
,
dd
)
rtts
=
[
10
,
20
]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
80
}]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
80
*
1024
}]
t
=
time
.
time
()
result
=
ResultSuccess
(
rtts
,
downloads
,
relay
,
circ
,
server_ip
,
scanner_nick
,
t
=
t
)
...
...
@@ -173,7 +173,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
nick
=
'
CowSayWhat2
'
relay_ip
=
'
169.254.100.2
'
rtts
=
[
50
,
250
]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
400
}]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
400
*
1024
}]
t
=
time
.
time
()
relay
=
Result
.
Relay
(
fp1
,
nick
,
relay_ip
)
result
=
ResultSuccess
(
rtts
,
downloads
,
relay
,
circ
,
server_ip
,
...
...
@@ -181,7 +181,7 @@ def dotsbws_success_result_two_relays(empty_dotsbws_datadir):
write_result_to_datadir
(
result
,
dd
)
rtts
=
[
100
,
200
]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
800
}]
downloads
=
[{
'
duration
'
:
4
,
'
amount
'
:
800
*
1024
}]
t
=
time
.
time
()
result
=
ResultSuccess
(
rtts
,
downloads
,
relay
,
circ
,
server_ip
,
scanner_nick
,
t
=
t
)
...
...
This diff is collapsed.
Click to expand it.
tests/core/test_generate.py
+
7
−
7
View file @
8e650d83
...
...
@@ -104,7 +104,7 @@ def test_generate_single_success_noscale(dotsbws_success_result, caplog,
v
=
'
version={}
'
.
format
(
version
)
assert
stdout_lines
[
1
]
==
v
bw
=
round
(
median
([
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
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
=
'
node_id=${} bw={} nick={} rtt={} time={}
'
.
format
(
...
...
@@ -166,8 +166,8 @@ def test_generate_single_relay_success_noscale(
v
=
'
version={}
'
.
format
(
version
)
assert
stdout_lines
[
1
]
==
v
speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
for
r
in
results
for
dl
in
r
.
downloads
]
speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
/
1024
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
=
'
node_id=${} bw={} nick={} rtt={} time={}
'
.
format
(
...
...
@@ -233,8 +233,8 @@ def test_generate_two_relays_success_noscale(
r1_time
=
round
(
max
([
r
.
time
for
r
in
r1_results
]))
r1_name
=
r1_results
[
0
].
nickname
r1_fingerprint
=
r1_results
[
0
].
fingerprint
r1_speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
for
r
in
r1_results
for
dl
in
r
.
downloads
]
r1_speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
/
1024
for
r
in
r1_results
for
dl
in
r
.
downloads
]
r1_speed
=
round
(
median
(
r1_speeds
))
r1_rtt
=
round
(
median
([
round
(
rtt
*
1000
)
for
r
in
r1_results
for
rtt
in
r
.
rtts
]))
...
...
@@ -246,8 +246,8 @@ def test_generate_two_relays_success_noscale(
r2_time
=
round
(
max
([
r
.
time
for
r
in
r2_results
]))
r2_name
=
r2_results
[
0
].
nickname
r2_fingerprint
=
r2_results
[
0
].
fingerprint
r2_speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
for
r
in
r2_results
for
dl
in
r
.
downloads
]
r2_speeds
=
[
dl
[
'
amount
'
]
/
dl
[
'
duration
'
]
/
1024
for
r
in
r2_results
for
dl
in
r
.
downloads
]
r2_speed
=
round
(
median
(
r2_speeds
))
r2_rtt
=
round
(
median
([
round
(
rtt
*
1000
)
for
r
in
r2_results
for
rtt
in
r
.
rtts
]))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment