lntest+github: add flag temptest to run tests separately

This commit adds a new flag `temptest` so we can run new and old tests
separately. This flag will be removed once the migration from old tests
to new tests is finished.
This commit is contained in:
yyforyongyu 2022-07-22 07:10:56 +08:00
parent 2e410dd248
commit 55f8a621ae
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
3 changed files with 125 additions and 0 deletions

View File

@ -373,6 +373,115 @@ jobs:
path: logs-itest-windows.zip
retention-days: 5
########################
# run new integration tests
########################
new-integration-test:
name: run new itests
runs-on: ubuntu-latest
strategy:
# Allow other tests in the matrix to continue if one fails.
fail-fast: false
matrix:
include:
- name: btcd
args: backend=btcd
- name: bitcoind
args: backend=bitcoind
- name: bitcoind-notxindex
args: backend="bitcoind notxindex"
- name: bitcoind-rpcpolling
args: backend="bitcoind rpcpolling"
- name: bitcoind-etcd
args: backend=bitcoind dbbackend=etcd
- name: bitcoind-postgres
args: backend=bitcoind dbbackend=postgres
- name: neutrino
args: backend=neutrino
steps:
- name: git checkout
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: install bitcoind
run: ./scripts/install_bitcoind.sh
- name: run new ${{ matrix.name }}
run: make itest-parallel temptest=true ${{ matrix.args }}
- name: Zip log files on failure
if: ${{ failure() }}
timeout-minutes: 1 # timeout after 1 minute
run: 7z a logs-itest-${{ matrix.name }}.zip lntest/itest/**/*.log
- name: Upload log files on failure
uses: actions/upload-artifact@v2.2.4
if: ${{ failure() }}
with:
name: logs-itest-${{ matrix.name }}
path: logs-itest-${{ matrix.name }}.zip
retention-days: 5
########################
# run new windows integration test
########################
new-windows-integration-test:
name: run new windows itest
runs-on: windows-latest
env:
GOCACHE: ${{ github.workspace }}/go/pkg/build
GOPATH: ${{ github.workspace }}/go
steps:
- name: git checkout
uses: actions/checkout@v2
- name: go cache
uses: actions/cache@v1
with:
path: ${{ env.GOPATH }}
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lnd-${{ runner.os }}-go-
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: run new itest
run: make itest-parallel temptest=true windows=1 tranches=2 parallel=2
- name: Zip log files on failure
if: ${{ failure() }}
run: 7z a logs-itest-windows.zip lntest/itest/**/*.log
- name: Upload log files on failure
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: logs-itest-windows
path: logs-itest-windows.zip
retention-days: 5
########################
# check pinned dependencies
########################

View File

@ -45,6 +45,13 @@ var (
// dbBackendFlag specifies the backend to use.
dbBackendFlag = flag.String("dbbackend", "bbolt", "Database backend "+
"(bbolt, etcd, postgres)")
// tempTest is a flag used to mark whether we should run the old or the
// new test cases. Used here so we can transit smoothly during our new
// itest construction.
//
// TODO(yy): remove temp flag.
tempTest = flag.Bool("temptest", false, "run the new tests(temp)")
)
// getTestCaseSplitTranche returns the sub slice of the test cases that should
@ -83,6 +90,10 @@ func getTestCaseSplitTranche() ([]*testCase, uint, uint) {
// TestLightningNetworkDaemon performs a series of integration tests amongst a
// programmatically driven network of lnd nodes.
func TestLightningNetworkDaemon(t *testing.T) {
if *tempTest {
t.Skip("Running new tests, old tests are skipped")
}
// If no tests are registered, then we can exit early.
if len(allTestCases) == 0 {
t.Skip("integration tests not selected with flag 'rpctest'")

View File

@ -9,6 +9,11 @@ NUM_ITEST_TRANCHES = 4
ITEST_PARALLELISM = $(NUM_ITEST_TRANCHES)
POSTGRES_START_DELAY = 5
# Build temp tests only. TODO(yy): remove.
ifneq ($(temptest),)
ITEST_FLAGS += -temptest=$(temptest)
endif
# If rpc option is set also add all extra RPC tags to DEV_TAGS
ifneq ($(with-rpc),)
DEV_TAGS += $(RPC_TAGS)