Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beat itest [3/3]: fix all itest flakes #9260

Open
wants to merge 32 commits into
base: yy-beat-itest-flakes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8baa1a3
itest: optimize blocks mined in `testGarbageCollectLinkNodes`
yyforyongyu Nov 8, 2024
8f4e260
itest: break remote signer into independent cases
yyforyongyu Nov 8, 2024
6d1c3c2
itest: break down channel restore commit types cases
yyforyongyu Nov 8, 2024
a9dbd36
itest: break down utxo selection funding tests
yyforyongyu Nov 8, 2024
6f26186
itest: break all multihop test cases
yyforyongyu Nov 8, 2024
428829a
itest: break down scid alias channel update tests
yyforyongyu Nov 8, 2024
c8e6d74
itest: break down open channel fee policy
yyforyongyu Nov 8, 2024
41ae04c
itest: break down payment failed tests
yyforyongyu Nov 8, 2024
b69e214
itest: break down channel backup restore tests
yyforyongyu Nov 8, 2024
c82610c
itest: break down wallet import account tests
yyforyongyu Nov 8, 2024
6bef51d
itest: break down basic funding flow tests
yyforyongyu Nov 9, 2024
f42b108
itest: break down single hop send to route
yyforyongyu Nov 9, 2024
80895be
itest: break down taproot tests
yyforyongyu Nov 9, 2024
c0ffd29
itest: break down channel fundmax tests
yyforyongyu Nov 9, 2024
93765f2
itest: breakdown `testSendDirectPayment`
yyforyongyu Dec 5, 2024
b3f99c3
itest: further reduce block mined in tests
yyforyongyu Nov 9, 2024
5326b1b
itest: track and skip flaky tests for windows
yyforyongyu Nov 7, 2024
fc7f282
lntest: increase node start timeout and payment benchmark timeout
yyforyongyu Nov 9, 2024
5aec1ff
lntest: make sure policies are populated in `AssertChannelInGraph`
yyforyongyu Nov 21, 2024
9aea852
workflows: use `btcd` for macOS
yyforyongyu Nov 9, 2024
9a819b8
itest+lntest: add new method `FundNumCoins`
yyforyongyu Nov 25, 2024
ef54c92
lntest: limit the num of blocks mined in each test
yyforyongyu Nov 25, 2024
72b0985
docs: update release notes
yyforyongyu Nov 26, 2024
b0a1f90
itest: add a prefix before appending a subtest case
yyforyongyu Dec 3, 2024
0ac77d5
itest: even out num of tests per tranche
yyforyongyu Dec 4, 2024
90e84c8
lntest: increase port timeout
yyforyongyu Dec 4, 2024
e39ba4d
lntest: add timeouts for windows
yyforyongyu Dec 4, 2024
0a0ab90
lntest: properly handle shutdown error
yyforyongyu Dec 5, 2024
2088e36
workflows: increase num of tranches to 16
yyforyongyu Dec 5, 2024
e31c412
lntest: make sure chain backend is synced to miner
yyforyongyu Dec 7, 2024
e1407ff
itest: document and fix wallet UTXO flake
yyforyongyu Dec 7, 2024
cc89b32
itest: fix flake in `testCoopCloseWithExternalDeliveryImpl`
yyforyongyu Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 79 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ defaults:
env:
BITCOIN_VERSION: "28"

TRANCHES: 8
# TRANCHES defines the number of tranches used in the itests.
TRANCHES: 16

# SMALL_TRANCHES defines the number of tranches used in the less stable itest
# builds
#
# TODO(yy): remove this value and use TRANCHES.
SMALL_TRANCHES: 8

# If you change this please also update GO_VERSION in Makefile (then run
# `make lint` to see where else it needs to be updated as well).
Expand Down Expand Up @@ -229,10 +236,10 @@ jobs:


########################
# run ubuntu integration tests
# run integration tests with TRANCHES
########################
ubuntu-integration-test:
name: run ubuntu itests
basic-integration-test:
name: basic itests
runs-on: ubuntu-latest
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
strategy:
Expand All @@ -246,20 +253,75 @@ jobs:
args: backend=bitcoind cover=1
- name: bitcoind-notxindex
args: backend="bitcoind notxindex"
- name: neutrino
args: backend=neutrino cover=1
steps:
- name: git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: fetch and rebase on ${{ github.base_ref }}
if: github.event_name == 'pull_request'
uses: ./.github/actions/rebase

- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
key-prefix: integration-test

- name: install bitcoind
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION

- name: run ${{ matrix.name }}
run: make itest-parallel tranches=${{ env.TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}

- name: Send coverage
if: ${{ contains(matrix.args, 'cover=1') }}
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.txt
flag-name: 'itest-${{ matrix.name }}'
parallel: true

- name: Zip log files on failure
if: ${{ failure() }}
timeout-minutes: 5 # timeout after 5 minute
run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log

- name: Upload log files on failure
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: logs-itest-${{ matrix.name }}
path: logs-itest-${{ matrix.name }}.zip
retention-days: 5

########################
# run integration tests with SMALL_TRANCHES
########################
integration-test:
name: itests
runs-on: ubuntu-latest
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
strategy:
# Allow other tests in the matrix to continue if one fails.
fail-fast: false
matrix:
include:
- name: bitcoind-rpcpolling
args: backend="bitcoind rpcpolling" cover=1
args: backend="bitcoind rpcpolling"
- name: bitcoind-etcd
args: backend=bitcoind dbbackend=etcd
- name: bitcoind-postgres
args: backend=bitcoind dbbackend=postgres
- name: bitcoind-sqlite
args: backend=bitcoind dbbackend=sqlite
- name: bitcoind-postgres-nativesql
args: backend=bitcoind dbbackend=postgres nativesql=true
- name: bitcoind-sqlite-nativesql
args: backend=bitcoind dbbackend=sqlite nativesql=true
- name: neutrino
args: backend=neutrino cover=1
- name: bitcoind-postgres
args: backend=bitcoind dbbackend=postgres
- name: bitcoind-postgres-nativesql
args: backend=bitcoind dbbackend=postgres nativesql=true
steps:
- name: git checkout
uses: actions/checkout@v3
Expand All @@ -280,7 +342,7 @@ jobs:
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION

- name: run ${{ matrix.name }}
run: make itest-parallel tranches=${{ env.TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}

- name: Send coverage
if: ${{ contains(matrix.args, 'cover=1') }}
Expand Down Expand Up @@ -308,7 +370,7 @@ jobs:
# run windows integration test
########################
windows-integration-test:
name: run windows itest
name: windows itest
runs-on: windows-latest
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
steps:
Expand All @@ -328,7 +390,7 @@ jobs:
key-prefix: integration-test

- name: run itest
run: make itest-parallel tranches=${{ env.TRANCHES }} windows=1 shuffleseed=${{ github.run_id }}
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} windows=1 shuffleseed=${{ github.run_id }}

- name: kill any remaining lnd processes
if: ${{ failure() }}
Expand All @@ -352,7 +414,7 @@ jobs:
# run macOS integration test
########################
macos-integration-test:
name: run macOS itest
name: macOS itest
runs-on: macos-14
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
steps:
Expand All @@ -371,14 +433,8 @@ jobs:
go-version: '${{ env.GO_VERSION }}'
key-prefix: integration-test

- name: install bitcoind
run: |
wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}.0/bitcoin-${BITCOIN_VERSION}.0-arm64-apple-darwin.tar.gz
tar zxvf bitcoin-${BITCOIN_VERSION}.0-arm64-apple-darwin.tar.gz
mv bitcoin-${BITCOIN_VERSION}.0 /tmp/bitcoin

- name: run itest
run: PATH=$PATH:/tmp/bitcoin/bin make itest-parallel tranches=${{ env.TRANCHES }} backend=bitcoind shuffleseed=${{ github.run_id }}
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} shuffleseed=${{ github.run_id }}

- name: Zip log files on failure
if: ${{ failure() }}
Expand Down Expand Up @@ -431,7 +487,7 @@ jobs:
# Notify about the completion of all coverage collecting jobs.
finish:
if: ${{ always() }}
needs: [unit-test, ubuntu-integration-test]
needs: [unit-test, basic-integration-test]
runs-on: ubuntu-latest
steps:
- uses: shogo82148/actions-goveralls@v1
Expand Down
4 changes: 4 additions & 0 deletions docs/release-notes/release-notes-0.19.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ The underlying functionality between those two options remain the same.
estimator provided by bitcoind or btcd in regtest and simnet modes instead of
static fee estimator if feeurl is not provided.

* The integration tests CI have been optimized to run faster and all flakes are
now documented and
[fixedo](https://github.com/lightningnetwork/lnd/pull/9260).

## Database

* [Migrate the mission control
Expand Down
111 changes: 111 additions & 0 deletions itest/list_exclude_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//go:build integration

package itest

import (
"fmt"

"github.com/lightningnetwork/lnd/fn/v2"
"github.com/lightningnetwork/lnd/lntest"
)

// excludedTestsWindows is a list of tests that are flaky on Windows and should
// be excluded from the test suite atm.
//
// TODO(yy): fix these tests and remove them from this list.
var excludedTestsWindows = []string{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uff, that's quite a list.... Do we have any idea what causes most of these to fail? Different behavior in network related code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few of them are related to graph syncing, then at some point I just stopped digging out why...instead I just repeat the pattern "test case failed -> add to the list" and hope we can figure out what happened there someday😂

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least we have a nice and tidy TODO list now :)

"batch channel funding",
"zero conf channel open",
"open channel with unstable utxos",
"funding flow persistence",

// Gives "channel link not found" error.
"zero conf-channel policy update public zero conf",

"listsweeps",
"sweep htlcs",
"sweep cpfp anchor incoming timeout",
"payment succeeded htlc remote swept",
"3rd party anchor spend",

"send payment amp",
"async payments benchmark",
"async bidirectional payments",

"multihop-htlc aggregation leased",
"multihop-htlc aggregation leased zero conf",
"multihop-htlc aggregation anchor",
"multihop-htlc aggregation anchor zero conf",
"multihop-htlc aggregation simple taproot",
"multihop-htlc aggregation simple taproot zero conf",

"channel force closure anchor",
"channel force closure simple taproot",
"channel backup restore force close",
"wipe forwarding packages",

"coop close with htlcs",
"coop close with external delivery",

"forward interceptor restart",
"forward interceptor dedup htlcs",
"invoice HTLC modifier basic",
"lookup htlc resolution",

"remote signer-taproot",
"remote signer-account import",
"remote signer-bump fee",
"remote signer-funding input types",
"remote signer-funding async payments taproot",
"remote signer-funding async payments",
"remote signer-random seed",
"remote signer-verify msg",
"remote signer-channel open",
"remote signer-shared key",
"remote signer-psbt",
"remote signer-sign output raw",

"on chain to blinded",
"query blinded route",

"data loss protection",
}

// filterWindowsFlakyTests filters out the flaky tests that are excluded from
// the test suite on Windows.
func filterWindowsFlakyTests() []*lntest.TestCase {
// filteredTestCases is a substest of allTestCases that excludes the
// above flaky tests.
filteredTestCases := make([]*lntest.TestCase, 0, len(allTestCases))

// Create a set for the excluded test cases for fast lookup.
excludedSet := fn.NewSet(excludedTestsWindows...)

// Remove the tests from the excludedSet if it's found in the list of
// all test cases. This is done to ensure the excluded tests are not
// pointing to a test case that doesn't exist.
for _, tc := range allTestCases {
if excludedSet.Contains(tc.Name) {
excludedSet.Remove(tc.Name)

continue
}

filteredTestCases = append(filteredTestCases, tc)
}

// Exit early if all the excluded tests are found in allTestCases.
if excludedSet.IsEmpty() {
return filteredTestCases
}

// Otherwise, print out the tests that are not found in allTestCases.
errStr := "\nThe following tests are not found, please make sure the " +
"test names are correct in `excludedTestsWindows`.\n"
for _, name := range excludedSet.ToSlice() {
errStr += fmt.Sprintf("Test not found in test suite: %v\n",
name)
}

panic(errStr)
}
Loading
Loading