v29.4-roots.4 · Commit 10: [PATCH 10/37] fix: harden final Roots assurance
test/functional/rpc_uptime.py
Before: test/functional/rpc_uptime.py · After: test/functional/rpc_uptime.py
File metadata
index fdf459953c006bed00607f447106253c32287fb8..8ab82f50e7ff3ab658977ab380cd63862cc4459d 100755
Download original patch · Release notes
Diff rows 1–26 of 26. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
test/functional/rpc_uptime.py
CHANGED
|
@@ -7,10 +7,11 @@
|
|
| 7 |
Test corresponds to code in rpc/server.cpp.
|
| 8 |
"""
|
| 9 |
|
| 10 |
-
import time
|
| 11 |
-
|
| 12 |
from test_framework.test_framework import BitcoinTestFramework
|
| 13 |
-
from test_framework.util import assert_raises_rpc_error
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
class UptimeTest(BitcoinTestFramework):
|
|
@@ -26,9 +27,9 @@ class UptimeTest(BitcoinTestFramework):
|
|
| 26 |
assert_raises_rpc_error(-8, "Mocktime must be in the range [0, 9223372036], not -1.", self.nodes[0].setmocktime, -1)
|
| 27 |
|
| 28 |
def _test_uptime(self):
|
| 29 |
-
wait_time = 10
|
| 30 |
-
self.nodes[0].setmocktime(int(time.time() + wait_time))
|
| 31 |
-
assert self.nodes[0].uptime() >= wait_time
|
| 32 |
|
| 33 |
|
| 34 |
if __name__ == '__main__':
|
|
|
|
| 7 |
Test corresponds to code in rpc/server.cpp.
|
| 8 |
"""
|
| 9 |
|
|
|
|
|
|
|
| 10 |
from test_framework.test_framework import BitcoinTestFramework
|
| 11 |
+
from test_framework.util import (
|
| 12 |
+
assert_greater_than_or_equal,
|
| 13 |
+
assert_raises_rpc_error,
|
| 14 |
+
)
|
| 15 |
|
| 16 |
|
| 17 |
class UptimeTest(BitcoinTestFramework):
|
|
|
|
| 27 |
assert_raises_rpc_error(-8, "Mocktime must be in the range [0, 9223372036], not -1.", self.nodes[0].setmocktime, -1)
|
| 28 |
|
| 29 |
def _test_uptime(self):
|
| 30 |
+
uptime_before = self.nodes[0].uptime()
|
| 31 |
+
self.nodes[0].setmocktime(10)
|
| 32 |
+
assert_greater_than_or_equal(self.nodes[0].uptime(), uptime_before)
|
| 33 |
|
| 34 |
|
| 35 |
if __name__ == '__main__':
|