Skip to content

Commit a388c1f

Browse files
authored
Merge pull request #9368 from lightningnetwork/yy-waiting-on-merge
Fix itest re new behaviors introduced by `blockbeat`
2 parents fe48e65 + 2913f6e commit a388c1f

File tree

74 files changed

+4189
-3660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4189
-3660
lines changed

.github/workflows/main.yml

+84-28
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ defaults:
2323
env:
2424
BITCOIN_VERSION: "28"
2525

26-
TRANCHES: 8
26+
# TRANCHES defines the number of tranches used in the itests.
27+
TRANCHES: 16
28+
29+
# SMALL_TRANCHES defines the number of tranches used in the less stable itest
30+
# builds
31+
#
32+
# TODO(yy): remove this value and use TRANCHES.
33+
SMALL_TRANCHES: 8
2734

2835
# If you change this please also update GO_VERSION in Makefile (then run
2936
# `make lint` to see where else it needs to be updated as well).
@@ -262,10 +269,10 @@ jobs:
262269

263270

264271
########################
265-
# run ubuntu integration tests
272+
# run integration tests with TRANCHES
266273
########################
267-
ubuntu-integration-test:
268-
name: run ubuntu itests
274+
basic-integration-test:
275+
name: basic itests
269276
runs-on: ubuntu-latest
270277
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
271278
strategy:
@@ -279,18 +286,6 @@ jobs:
279286
args: backend=bitcoind cover=1
280287
- name: bitcoind-notxindex
281288
args: backend="bitcoind notxindex"
282-
- name: bitcoind-rpcpolling
283-
args: backend="bitcoind rpcpolling" cover=1
284-
- name: bitcoind-etcd
285-
args: backend=bitcoind dbbackend=etcd
286-
- name: bitcoind-postgres
287-
args: backend=bitcoind dbbackend=postgres
288-
- name: bitcoind-sqlite
289-
args: backend=bitcoind dbbackend=sqlite
290-
- name: bitcoind-postgres-nativesql
291-
args: backend=bitcoind dbbackend=postgres nativesql=true
292-
- name: bitcoind-sqlite-nativesql
293-
args: backend=bitcoind dbbackend=sqlite nativesql=true
294289
- name: neutrino
295290
args: backend=neutrino cover=1
296291
steps:
@@ -316,7 +311,7 @@ jobs:
316311
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION
317312

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

321316
- name: Send coverage
322317
if: ${{ contains(matrix.args, 'cover=1') }}
@@ -339,12 +334,79 @@ jobs:
339334
path: logs-itest-${{ matrix.name }}.zip
340335
retention-days: 5
341336

337+
########################
338+
# run integration tests with SMALL_TRANCHES
339+
########################
340+
integration-test:
341+
name: itests
342+
runs-on: ubuntu-latest
343+
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
344+
strategy:
345+
# Allow other tests in the matrix to continue if one fails.
346+
fail-fast: false
347+
matrix:
348+
include:
349+
- name: bitcoind-rpcpolling
350+
args: backend="bitcoind rpcpolling"
351+
- name: bitcoind-etcd
352+
args: backend=bitcoind dbbackend=etcd
353+
- name: bitcoind-sqlite
354+
args: backend=bitcoind dbbackend=sqlite
355+
- name: bitcoind-sqlite-nativesql
356+
args: backend=bitcoind dbbackend=sqlite nativesql=true
357+
- name: bitcoind-postgres
358+
args: backend=bitcoind dbbackend=postgres
359+
- name: bitcoind-postgres-nativesql
360+
args: backend=bitcoind dbbackend=postgres nativesql=true
361+
steps:
362+
- name: git checkout
363+
uses: actions/checkout@v3
364+
with:
365+
fetch-depth: 0
366+
367+
- name: fetch and rebase on ${{ github.base_ref }}
368+
if: github.event_name == 'pull_request'
369+
uses: ./.github/actions/rebase
370+
371+
- name: setup go ${{ env.GO_VERSION }}
372+
uses: ./.github/actions/setup-go
373+
with:
374+
go-version: '${{ env.GO_VERSION }}'
375+
key-prefix: integration-test
376+
377+
- name: install bitcoind
378+
run: ./scripts/install_bitcoind.sh $BITCOIN_VERSION
379+
380+
- name: run ${{ matrix.name }}
381+
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} ${{ matrix.args }} shuffleseed=${{ github.run_id }}${{ strategy.job-index }}
382+
383+
- name: Send coverage
384+
if: ${{ contains(matrix.args, 'cover=1') }}
385+
uses: shogo82148/actions-goveralls@v1
386+
with:
387+
path-to-profile: coverage.txt
388+
flag-name: 'itest-${{ matrix.name }}'
389+
parallel: true
390+
391+
- name: Zip log files on failure
392+
if: ${{ failure() }}
393+
timeout-minutes: 5 # timeout after 5 minute
394+
run: 7z a logs-itest-${{ matrix.name }}.zip itest/**/*.log
395+
396+
- name: Upload log files on failure
397+
uses: actions/upload-artifact@v3
398+
if: ${{ failure() }}
399+
with:
400+
name: logs-itest-${{ matrix.name }}
401+
path: logs-itest-${{ matrix.name }}.zip
402+
retention-days: 5
403+
342404

343405
########################
344406
# run windows integration test
345407
########################
346408
windows-integration-test:
347-
name: run windows itest
409+
name: windows itest
348410
runs-on: windows-latest
349411
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
350412
steps:
@@ -364,7 +426,7 @@ jobs:
364426
key-prefix: integration-test
365427

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

369431
- name: kill any remaining lnd processes
370432
if: ${{ failure() }}
@@ -388,7 +450,7 @@ jobs:
388450
# run macOS integration test
389451
########################
390452
macos-integration-test:
391-
name: run macOS itest
453+
name: macOS itest
392454
runs-on: macos-14
393455
if: '!contains(github.event.pull_request.labels.*.name, ''no-itest'')'
394456
steps:
@@ -407,14 +469,8 @@ jobs:
407469
go-version: '${{ env.GO_VERSION }}'
408470
key-prefix: integration-test
409471

410-
- name: install bitcoind
411-
run: |
412-
wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}.0/bitcoin-${BITCOIN_VERSION}.0-arm64-apple-darwin.tar.gz
413-
tar zxvf bitcoin-${BITCOIN_VERSION}.0-arm64-apple-darwin.tar.gz
414-
mv bitcoin-${BITCOIN_VERSION}.0 /tmp/bitcoin
415-
416472
- name: run itest
417-
run: PATH=$PATH:/tmp/bitcoin/bin make itest-parallel tranches=${{ env.TRANCHES }} backend=bitcoind
473+
run: make itest-parallel tranches=${{ env.SMALL_TRANCHES }} shuffleseed=${{ github.run_id }}
418474

419475
- name: Zip log files on failure
420476
if: ${{ failure() }}
@@ -473,7 +529,7 @@ jobs:
473529
# Notify about the completion of all coverage collecting jobs.
474530
finish:
475531
if: ${{ always() }}
476-
needs: [unit-test, ubuntu-integration-test]
532+
needs: [unit-test, basic-integration-test]
477533
runs-on: ubuntu-latest
478534
steps:
479535
- uses: ziggie1984/actions-goveralls@c440f43938a4032b627d2b03d61d4ae1a2ba2b5c

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ clean-itest-logs:
220220
itest-only: clean-itest-logs db-instance
221221
@$(call print, "Running integration tests with ${backend} backend.")
222222
date
223-
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_part.sh 0 1 $(TEST_FLAGS) $(ITEST_FLAGS) -test.v
223+
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_part.sh 0 1 $(SHUFFLE_SEED) $(TEST_FLAGS) $(ITEST_FLAGS) -test.v
224224
$(COLLECT_ITEST_COVERAGE)
225225

226226
#? itest: Build and run integration tests
@@ -233,7 +233,7 @@ itest-race: build-itest-race itest-only
233233
itest-parallel: clean-itest-logs build-itest db-instance
234234
@$(call print, "Running tests")
235235
date
236-
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)
236+
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(SHUFFLE_SEED) $(TEST_FLAGS) $(ITEST_FLAGS)
237237
$(COLLECT_ITEST_COVERAGE)
238238

239239
#? itest-clean: Kill all running itest processes

docs/release-notes/release-notes-0.19.0.md

+4
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ The underlying functionality between those two options remain the same.
221221
estimator provided by bitcoind or btcd in regtest and simnet modes instead of
222222
static fee estimator if feeurl is not provided.
223223

224+
* The integration tests CI have been optimized to run faster and all flakes are
225+
now documented and
226+
[fixed](https://github.com/lightningnetwork/lnd/pull/9368).
227+
224228
## Database
225229

226230
* [Migrate the mission control

itest/list_exclude_test.go

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//go:build integration
2+
3+
package itest
4+
5+
import (
6+
"fmt"
7+
8+
"github.com/lightningnetwork/lnd/fn/v2"
9+
"github.com/lightningnetwork/lnd/lntest"
10+
)
11+
12+
// excludedTestsWindows is a list of tests that are flaky on Windows and should
13+
// be excluded from the test suite atm.
14+
//
15+
// TODO(yy): fix these tests and remove them from this list.
16+
var excludedTestsWindows = []string{
17+
"batch channel funding",
18+
"zero conf channel open",
19+
"open channel with unstable utxos",
20+
"funding flow persistence",
21+
22+
// Gives "channel link not found" error.
23+
"zero conf-channel policy update public zero conf",
24+
25+
"listsweeps",
26+
"sweep htlcs",
27+
"sweep cpfp anchor incoming timeout",
28+
"payment succeeded htlc remote swept",
29+
"3rd party anchor spend",
30+
31+
"send payment amp",
32+
"async payments benchmark",
33+
"async bidirectional payments",
34+
35+
"multihop-htlc aggregation leased",
36+
"multihop-htlc aggregation leased zero conf",
37+
"multihop-htlc aggregation anchor",
38+
"multihop-htlc aggregation anchor zero conf",
39+
"multihop-htlc aggregation simple taproot",
40+
"multihop-htlc aggregation simple taproot zero conf",
41+
42+
"channel force closure anchor",
43+
"channel force closure simple taproot",
44+
"channel backup restore force close",
45+
"wipe forwarding packages",
46+
47+
"coop close with htlcs",
48+
"coop close with external delivery",
49+
50+
"forward interceptor restart",
51+
"forward interceptor dedup htlcs",
52+
"invoice HTLC modifier basic",
53+
"lookup htlc resolution",
54+
55+
"remote signer-taproot",
56+
"remote signer-account import",
57+
"remote signer-bump fee",
58+
"remote signer-funding input types",
59+
"remote signer-funding async payments taproot",
60+
"remote signer-funding async payments",
61+
"remote signer-random seed",
62+
"remote signer-verify msg",
63+
"remote signer-channel open",
64+
"remote signer-shared key",
65+
"remote signer-psbt",
66+
"remote signer-sign output raw",
67+
68+
"on chain to blinded",
69+
"query blinded route",
70+
71+
"data loss protection",
72+
}
73+
74+
// filterWindowsFlakyTests filters out the flaky tests that are excluded from
75+
// the test suite on Windows.
76+
func filterWindowsFlakyTests() []*lntest.TestCase {
77+
// filteredTestCases is a substest of allTestCases that excludes the
78+
// above flaky tests.
79+
filteredTestCases := make([]*lntest.TestCase, 0, len(allTestCases))
80+
81+
// Create a set for the excluded test cases for fast lookup.
82+
excludedSet := fn.NewSet(excludedTestsWindows...)
83+
84+
// Remove the tests from the excludedSet if it's found in the list of
85+
// all test cases. This is done to ensure the excluded tests are not
86+
// pointing to a test case that doesn't exist.
87+
for _, tc := range allTestCases {
88+
if excludedSet.Contains(tc.Name) {
89+
excludedSet.Remove(tc.Name)
90+
91+
continue
92+
}
93+
94+
filteredTestCases = append(filteredTestCases, tc)
95+
}
96+
97+
// Exit early if all the excluded tests are found in allTestCases.
98+
if excludedSet.IsEmpty() {
99+
return filteredTestCases
100+
}
101+
102+
// Otherwise, print out the tests that are not found in allTestCases.
103+
errStr := "\nThe following tests are not found, please make sure the " +
104+
"test names are correct in `excludedTestsWindows`.\n"
105+
for _, name := range excludedSet.ToSlice() {
106+
errStr += fmt.Sprintf("Test not found in test suite: %v\n",
107+
name)
108+
}
109+
110+
panic(errStr)
111+
}

0 commit comments

Comments
 (0)