itest

package
v0.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 27 Imported by: 0

README

Chantools Integration Test (itest)

This directory contains the integration test (itest) setup and test cases for chantools. The test network is created using Docker Compose scripts and consists of multiple Lightning Network nodes connected in a specific topology to create multiple channels with non-zero channel update indexes (by sending some payments around the network).

Test Network Topology

The network is set up as follows:

    Alice ◄──► Bob ◄──► Charlie ◄──► Dave
       └───────►└──► Rusty ◄──┘
       |     Nifty ◄──┘       |
       └► Snyke ◄─────────────┘
  • Channel Alice - Bob: Remains open, used by runZombieRecoveryLndLnd.
  • Channel Alice - Rusty: Is force closed by Alice, used by runSweepRemoteClosedCln.
  • Channel Alice - Snyke: Remains open, used by runTriggerForceCloseCln.
  • Channel Bob - Charlie: Is force closed by Bob, used by runSweepRemoteClosedLnd.
  • Channel Charlie - Dave: Remains open, used by runTriggerForceCloseLnd.
  • Channel Charlie - Snyke: Remains open, used by runSCBForceClose.
  • Channel Bob - Rusty: Remains open, used by runZombieRecoveryLndCln.
  • Channel Rusty - Charlie: Remains open, used by runZombieRecoveryClnLnd.
  • Channel Rusty - Nifty: Remains open, used by runZombieRecoveryClnCln.

All nodes except for Dave and Snyke are stopped before the integration tests are run.

Multiple channels are opened between the nodes, and several multi-hop payments are executed to ensure the network is fully operational and synchronized. After the setup, each node's channel information is exported to a JSON file in the node-data/chantools/ directory.

Running the Integration Tests

To start the integration tests, run the following command from the project root:

make itest

Which executes the script itest/itest.sh.

This script will:

  • Build and start the Docker-based test network.
  • Set up the channels and perform payments between nodes.
  • Export channel data for each node.
  • Run the Go integration tests against the prepared network.

Debugging the Test Network

By default, the test network is torn down automatically after the tests finish or if an error occurs. If you want to keep the Docker containers running for debugging purposes, set the DEBUG environment variable before running the script:

make itest DEBUG=1

With DEBUG set, the containers will not be stopped automatically, allowing you to inspect the state of the network and containers for troubleshooting and run the Golang based integration tests manually several times.


For more details on the network setup, see docker/setup-test-network.sh.

Documentation

Overview

nolint: unparam

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChantoolsProcess

type ChantoolsProcess struct {
	// contains filtered or unexported fields
}

ChantoolsProcess wraps a running chantools process for integration testing.

func StartChantools

func StartChantools(t *testing.T, args ...string) *ChantoolsProcess

StartChantools starts the chantools binary with the given arguments.

func (*ChantoolsProcess) AssertNoStderr added in v0.14.2

func (p *ChantoolsProcess) AssertNoStderr(t *testing.T)

func (*ChantoolsProcess) Kill

func (p *ChantoolsProcess) Kill(t *testing.T)

Kill kills the process.

func (*ChantoolsProcess) ReadAllOutput

func (p *ChantoolsProcess) ReadAllOutput(t *testing.T) string

ReadAllOutput reads all output from the process's stdout until EOF.

func (*ChantoolsProcess) ReadAvailableOutput

func (p *ChantoolsProcess) ReadAvailableOutput(t *testing.T,
	timeout time.Duration) string

ReadAvailableOutput reads as many bytes as possible from stdout until the timeout elapses.

func (*ChantoolsProcess) Wait

func (p *ChantoolsProcess) Wait(t *testing.T)

Wait waits for the process to exit.

func (*ChantoolsProcess) WriteInput

func (p *ChantoolsProcess) WriteInput(t *testing.T, input string)

WriteInput writes input to the process's stdin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL