Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
8fdd85b7
Unverified
Commit
8fdd85b7
authored
Nov 30, 2020
by
Georg Koppen
Browse files
Merge remote-tracking branch 'gitlab/merge-requests/34' into maint-1.1
parents
81d2bea0
f0140841
Changes
4
Hide whitespace changes
Inline
Side-by-side
sbws/core/scanner.py
View file @
8fdd85b7
...
...
@@ -523,7 +523,8 @@ def main_loop(args, conf, controller, relay_list, circuit_builder, result_dump,
# Don't start measuring a relay if sbws is stopping.
if
settings
.
end_event
.
is_set
():
break
relay_list
.
increment_recent_measurement_attempt
()
# 40023, disable to decrease state.dat json lines
# relay_list.increment_recent_measurement_attempt()
target
.
increment_relay_recent_measurement_attempt
()
num_relays
+=
1
# callback and callback_err must be non-blocking
...
...
tests/integration/test_files.py
View file @
8fdd85b7
...
...
@@ -32,7 +32,9 @@ def test_state(conf):
assert
1
==
state
.
count
(
"recent_consensus"
)
assert
1
==
state
.
count
(
"recent_priority_list"
)
assert
15
==
state
.
count
(
"recent_priority_relay"
)
assert
15
==
state
.
count
(
"recent_measurement_attempt"
)
# Because of 40023, it's 0. Change to 15 if we store it again at some point
# assert 15 == state.count("recent_measurement_attempt")
assert
not
state
.
count
(
"recent_measurement_attempt"
)
def
test_v3bwfile
(
conf
):
...
...
@@ -42,7 +44,8 @@ def test_v3bwfile(conf):
assert
"1"
==
bwfile
.
header
.
recent_consensus_count
assert
"1"
==
bwfile
.
header
.
recent_priority_list_count
assert
"15"
==
bwfile
.
header
.
recent_priority_relay_count
assert
"15"
==
bwfile
.
header
.
recent_measurement_attempt_count
# Because of 40023, there is not this header
# assert "15" == bwfile.header.recent_measurement_attempt_count
for
bwline
in
bwfile
.
bw_lines
:
assert
1
==
bwline
.
relay_in_recent_consensus_count
assert
1
==
bwline
.
relay_recent_priority_list_count
...
...
tests/unit/lib/test_heartbeat.py
View file @
8fdd85b7
"""Unit tests for heartbeat"""
import
logging
import
pytest
from
sbws.lib
import
heartbeat
from
sbws.util.state
import
State
@
pytest
.
mark
.
skip
(
reason
=
"increment_recent_measurement_attempt() disabled"
)
def
test_total_measured_percent
(
conf
,
caplog
):
state
=
State
(
conf
[
"paths"
][
"state_fname"
])
state
[
"recent_priority_list"
]
=
[
1
,
2
,
3
]
...
...
tests/unit/lib/test_v3bwfile.py
View file @
8fdd85b7
...
...
@@ -4,6 +4,7 @@ import json
import
logging
import
math
import
os.path
import
pytest
from
unittest
import
mock
from
sbws
import
__version__
as
version
...
...
@@ -588,6 +589,7 @@ def test_recent_consensus_count(root_data_path, datadir):
assert
"1"
==
header
.
recent_consensus_count
@
pytest
.
mark
.
skip
(
reason
=
"increment_recent_measurement_attempt() disabled"
)
def
test_recent_measurement_attempt_count
(
root_data_path
,
datadir
):
state_fpath
=
os
.
path
.
join
(
root_data_path
,
'.sbws/state.dat'
)
assert
15
==
V3BWHeader
.
recent_measurement_attempt_count_from_file
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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