You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

uptime.py 799B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python3
  2. # Copyright (c) 2017 The Bitcoin Core developers
  3. # Distributed under the MIT software license, see the accompanying
  4. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
  5. """Test the RPC call related to the uptime command.
  6. Test corresponds to code in rpc/server.cpp.
  7. """
  8. import time
  9. from test_framework.test_framework import BitcoinTestFramework
  10. class UptimeTest(BitcoinTestFramework):
  11. def set_test_params(self):
  12. self.num_nodes = 1
  13. self.setup_clean_chain = True
  14. def run_test(self):
  15. self._test_uptime()
  16. def _test_uptime(self):
  17. wait_time = 10
  18. self.nodes[0].setmocktime(int(time.time() + wait_time))
  19. assert(self.nodes[0].uptime() >= wait_time)
  20. if __name__ == '__main__':
  21. UptimeTest().main()