Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2 protected
  • release/runtime-800 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
  • runtime-401 protected
  • v0.4.0 protected
40 results

pallets

  • Clone with SSH
  • Clone with HTTPS
  • Functional testing for lc-core

    This folder contains a set of functional tests designed for lc-core.

    It is written in typescript, using Mocha/Chai as Test framework.

    Test flow

    Each group will start a dev service with the development spec before executing the tests.

    Installation

    npm install

    Run the tests

    npm run test

    and to print more information:

    npm run test-with-logs

    Write Tests

    Verbose mode

    You can also add the node's logs to the output using the LC_CORE_LOG env variable. Ex:

    LC_CORE_LOG="warn,rpc=trace" npm run test

    The test script will find available ports above 20000 in order to ensure that it doesn't conflict with any other running services.

    Debugging a lc-core node

    The repository contains a pre-configured debugger configuration for VSCode with the CodeLLDB (vadimcn.vscode-lldb) extension.

    Before debugging, you need to build the node with debug symbols with command RUSTFLAGS=-g cargo build --release (available as a VSCode task). Then go in the Debug tab in the left bar of VSCode and make sure Launch lc-core Node (Linux) is selected in the top dropdown. Build & Launch lc-core Node (Linux) will trigger the build before launching the node.

    To launch the debug session click on the green "play" arrow next to the dropdown. It will take some time before the node starts, but the terminal containing the node output will appear when it is really starting. The node is listening on ports 19931 (p2p), 19932 (rpc) and 19933 (ws).

    You can explore the code and place a breakpoint on a line by left clicking on the left of the line number. The execution will pause the next time this line is reached. The debug toolbar contains the following buttons :

    • Resume/Pause : Resume the execution if paused, pause the execution at the current location (pretty random) if running.
    • Step over : Resume the execution until next line, or go one level up if the end of the current scope is reached.
    • Step into : Resume the execution to go inside the immediatly next function call if any, otherwise step to next line.
    • Step out : Resume the execution until the end of the scope is reached.
    • Restart : Kill the program and start a new debuging session.
    • Stop : Kill the program and end debugin session.

    Breakpoints stay between debugging sessions. When multiple function calls are made on the same line, multiple step into, step out, step into, ... can be requiered to go inside one of the chained calls.

    When paused, content of variables is showed in the debuging tab of VSCode. Some basic types are displayed correctly (primitive types, Vec, Arc) but more complex types such as HashMap/BTreeMap are not "smartly" displayed (content of the struct is shown by mapping is hidden in the complexity of the implementation).

    Running Typescript tests with a debug node

    By setting the environement variable DEBUG_MODE=true, the Typescript tests will not spawn its own node and instead will connect to an external node running on ports 19931/19932/19933, which are the ports used by the debug node.

    A VSCode test allow to quickly run the test-single test in debug mode. To run another test, change the command in the package.json. Note that you should restart the node after running one test file.