Skip to content

Latest commit

 

History

History
 
 

test

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Integration tests

Basic usage.

Documentation for installation of dependencies and running these tests can be found with the Rippled build instructions. (Also for Windows, OS X, or Ubuntu.)

Advanced usage.

These instructions assume familiarity with the instructions linked above.

Debugging rippled

By default, each test will start and stop an independent instance of rippled. This ensures that each test is run against the known genesis ledger.

To use a running rippled, particularly one running in a debugger, follow these steps:

Setup

Using configuration files
  1. Make a copy of the example configuration file: cp -i test/config-example.js test/config.js

  2. Edit test/config.js to select the "debug" server configuration.

  • Change the existing default server to: exports.server_default = "debug"; (near the top of the file).
  1. Create a rippled.cfg file for the tests.
  2. Run npm test. The tests will fail. This failure is expected.
  3. Copy and/or rename the tmp/server/debug/rippled.cfg file to somewhere convenient.
Using the command line
  1. Create a rippled.cfg file for the tests.
  2. Run npm test --noserver. The tests will fail. This failure is expected.
  3. Copy and/or rename the tmp/server/alpha/rippled.cfg file to somewhere convenient.

Running the tests.

  1. Start rippled (in a debugger) with command line options -av --conf <rippled-created-above.cfg>.

  2. Set any desired breakpoints in the rippled source.

  3. Running one test per genesis ledger is highly recommended. If the relevant .js file contains more than one test, change test( to test.only( for the single desired test.

  • To run multiple tests, change test( to test.skip( for any undesired tests in the .js file.
  1. Start test(s) in the node-inspector debugger. (The tests can be run without the debugger, but there will probably be problems with timeouts or reused ledgers).

  2. node_modules/node-inspector/bin/inspector.js &

  3. node node_modules/.bin/mocha --debug --debug-brk test/<testfile.js>

  4. Browse to http://127.0.0.1:8080/debug?port=5858 in a browser supported by node-inspector (i.e. Chrome or Safari).

  5. To run multiple tests (not recommended), put a breakpoint in the following function:

  • File testutils.js -> function build_teardown() -> nested function teardown() -> nested series function stop_server().
    • When this breakpoint is hit, stop and restart rippled.
  1. Use the node-inspector UI to step through and run the test(s) until control is handed off to rippled. When the request is finished control will be handed back to node-inspector, which may or may not stop depending on which breakpoints are set.

After debugging using configuration files.

With the command line --noserver flag, this step is unnecessary.

  1. To return to the default behavior, edit test/config.js and change the default server back to its original value: exports.server_default = "alpha";.
  • Alternately, delete test/config.js.