diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6a22078c8..03e6aa940 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 ######################## diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index ebffaa91c..79e09f4a5 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -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'") diff --git a/make/testing_flags.mk b/make/testing_flags.mk index a81ce19cc..893185cd8 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -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)