lnd icon indicating copy to clipboard operation
lnd copied to clipboard

itest: start a scaffolding testing framework

Open yyforyongyu opened this issue 3 years ago • 1 comments

This PR introduces an almost new testing framework. To avoid interfering with other PRs and rebasing hell, a new test flag temptest is added so we can run both the new and the old tests together. The migration is done in three phases,

  1. introduce the package lntemp as the scaffolding while transiting the old tests.
  2. refactor all the old tests with the new framework.
  3. remove lntest and rename the package lntemp to lntest.

Notable changes

  • HarnessRPC, which wraps all the rpc clients and adds a layer of require.NoError over all the rpc calls. We want this because often the time the error from the gRPC layer is not something we want to test. By hiding the error check, the test can focus on the state change of a given node. Meanwhile, all the clients in HarnessRPC are exported in case we do want to check the error. This struct is the foundation of everything.
  • HarnessNode, which is responsible for managing the lnd process, grpc connection and wallet auth. In addition, it has three structs,
    • HarnessRPC, manages rpc calls.
    • State, holds an internal state of the node, such as num of open channels, utxos, etc.
    • nodeWatcher, watches the topology updates for the node.
  • HarnessMiner, stays unchanged except miner-related rpc calls are now managed by it.
  • HarnessTest, which is the assertion machine that manages the interaction among nodes.

A new github action is also added. From now on, the new tests should NOT fail.

This PR replaces #5940(refactor of a refactor🤓), and its following PRs,

  1. #6776
  2. #6822
  3. #6823
  4. #6824
  5. #6825

yyforyongyu avatar Jul 22 '22 12:07 yyforyongyu

@yyforyongyu, remember to re-request review from reviewers when ready

lightninglabs-deploy avatar Sep 19 '22 21:09 lightninglabs-deploy

@yyforyongyu, remember to re-request review from reviewers when ready

lightninglabs-deploy avatar Oct 10 '22 00:10 lightninglabs-deploy