mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
Merge pull request #7364 from guggero/itest-coverage
Add test coverage for integration tests
This commit is contained in:
commit
c68778d2f3
5 changed files with 38 additions and 6 deletions
27
.github/workflows/main.yml
vendored
27
.github/workflows/main.yml
vendored
|
@ -225,6 +225,7 @@ jobs:
|
||||||
if: matrix.unit_type == 'btcd unit-cover'
|
if: matrix.unit_type == 'btcd unit-cover'
|
||||||
with:
|
with:
|
||||||
path-to-profile: coverage.txt
|
path-to-profile: coverage.txt
|
||||||
|
flag-name: 'unit'
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,13 +242,13 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- name: btcd
|
- name: btcd
|
||||||
args: backend=btcd
|
args: backend=btcd cover=1
|
||||||
- name: bitcoind
|
- name: bitcoind
|
||||||
args: backend=bitcoind
|
args: backend=bitcoind cover=1
|
||||||
- name: bitcoind-notxindex
|
- name: bitcoind-notxindex
|
||||||
args: backend="bitcoind notxindex"
|
args: backend="bitcoind notxindex"
|
||||||
- name: bitcoind-rpcpolling
|
- name: bitcoind-rpcpolling
|
||||||
args: backend="bitcoind rpcpolling"
|
args: backend="bitcoind rpcpolling" cover=1
|
||||||
- name: bitcoind-etcd
|
- name: bitcoind-etcd
|
||||||
args: backend=bitcoind dbbackend=etcd
|
args: backend=bitcoind dbbackend=etcd
|
||||||
- name: bitcoind-postgres
|
- name: bitcoind-postgres
|
||||||
|
@ -259,7 +260,7 @@ jobs:
|
||||||
- name: bitcoind-sqlite-nativesql
|
- name: bitcoind-sqlite-nativesql
|
||||||
args: backend=bitcoind dbbackend=sqlite nativesql=true
|
args: backend=bitcoind dbbackend=sqlite nativesql=true
|
||||||
- name: neutrino
|
- name: neutrino
|
||||||
args: backend=neutrino
|
args: backend=neutrino cover=1
|
||||||
steps:
|
steps:
|
||||||
- name: git checkout
|
- name: git checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -276,6 +277,14 @@ jobs:
|
||||||
- name: run ${{ matrix.name }}
|
- name: run ${{ matrix.name }}
|
||||||
run: make itest-parallel ${{ matrix.args }}
|
run: make itest-parallel ${{ matrix.args }}
|
||||||
|
|
||||||
|
- 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
|
- name: Zip log files on failure
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
timeout-minutes: 5 # timeout after 5 minute
|
timeout-minutes: 5 # timeout after 5 minute
|
||||||
|
@ -401,3 +410,13 @@ jobs:
|
||||||
|
|
||||||
- name: release notes check
|
- name: release notes check
|
||||||
run: scripts/check-release-notes.sh
|
run: scripts/check-release-notes.sh
|
||||||
|
|
||||||
|
# Notify about the completion of all coverage collecting jobs.
|
||||||
|
finish:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: [unit-test, ubuntu-integration-test]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: shogo82148/actions-goveralls@v1
|
||||||
|
with:
|
||||||
|
parallel-finished: true
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -38,6 +38,7 @@ itest/.minerlogs
|
||||||
itest/lnd-itest
|
itest/lnd-itest
|
||||||
itest/btcd-itest
|
itest/btcd-itest
|
||||||
itest/.logs-*
|
itest/.logs-*
|
||||||
|
itest/cover
|
||||||
|
|
||||||
cmd/cmd
|
cmd/cmd
|
||||||
*.key
|
*.key
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -111,7 +111,7 @@ build:
|
||||||
build-itest:
|
build-itest:
|
||||||
@$(call print, "Building itest btcd and lnd.")
|
@$(call print, "Building itest btcd and lnd.")
|
||||||
CGO_ENABLED=0 $(GOBUILD) -tags="integration" -o itest/btcd-itest$(EXEC_SUFFIX) $(DEV_LDFLAGS) $(BTCD_PKG)
|
CGO_ENABLED=0 $(GOBUILD) -tags="integration" -o itest/btcd-itest$(EXEC_SUFFIX) $(DEV_LDFLAGS) $(BTCD_PKG)
|
||||||
CGO_ENABLED=0 $(GOBUILD) -tags="$(ITEST_TAGS)" -o itest/lnd-itest$(EXEC_SUFFIX) $(DEV_LDFLAGS) $(PKG)/cmd/lnd
|
CGO_ENABLED=0 $(GOBUILD) -tags="$(ITEST_TAGS)" $(ITEST_COVERAGE) -o itest/lnd-itest$(EXEC_SUFFIX) $(DEV_LDFLAGS) $(PKG)/cmd/lnd
|
||||||
|
|
||||||
@$(call print, "Building itest binary for ${backend} backend.")
|
@$(call print, "Building itest binary for ${backend} backend.")
|
||||||
CGO_ENABLED=0 $(GOTEST) -v ./itest -tags="$(DEV_TAGS) $(RPC_TAGS) integration $(backend)" -c -o itest/itest.test$(EXEC_SUFFIX)
|
CGO_ENABLED=0 $(GOTEST) -v ./itest -tags="$(DEV_TAGS) $(RPC_TAGS) integration $(backend)" -c -o itest/itest.test$(EXEC_SUFFIX)
|
||||||
|
@ -198,6 +198,7 @@ itest-only: db-instance
|
||||||
@$(call print, "Running integration tests with ${backend} backend.")
|
@$(call print, "Running integration tests with ${backend} backend.")
|
||||||
rm -rf itest/*.log itest/.logs-*; date
|
rm -rf itest/*.log itest/.logs-*; date
|
||||||
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_part.sh 0 1 $(TEST_FLAGS) $(ITEST_FLAGS)
|
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_part.sh 0 1 $(TEST_FLAGS) $(ITEST_FLAGS)
|
||||||
|
$(COLLECT_ITEST_COVERAGE)
|
||||||
|
|
||||||
#? itest: Build and run integration tests
|
#? itest: Build and run integration tests
|
||||||
itest: build-itest itest-only
|
itest: build-itest itest-only
|
||||||
|
@ -210,6 +211,7 @@ itest-parallel: build-itest db-instance
|
||||||
@$(call print, "Running tests")
|
@$(call print, "Running tests")
|
||||||
rm -rf itest/*.log itest/.logs-*; date
|
rm -rf itest/*.log itest/.logs-*; date
|
||||||
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)
|
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)
|
||||||
|
$(COLLECT_ITEST_COVERAGE)
|
||||||
|
|
||||||
#? itest-clean: Kill all running itest processes
|
#? itest-clean: Kill all running itest processes
|
||||||
itest-clean:
|
itest-clean:
|
||||||
|
|
|
@ -2,7 +2,9 @@ DEV_TAGS = dev
|
||||||
RPC_TAGS = autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc routerrpc signrpc verrpc walletrpc watchtowerrpc wtclientrpc
|
RPC_TAGS = autopilotrpc chainrpc invoicesrpc neutrinorpc peersrpc routerrpc signrpc verrpc walletrpc watchtowerrpc wtclientrpc
|
||||||
LOG_TAGS =
|
LOG_TAGS =
|
||||||
TEST_FLAGS =
|
TEST_FLAGS =
|
||||||
ITEST_FLAGS =
|
ITEST_FLAGS =
|
||||||
|
ITEST_COVERAGE =
|
||||||
|
COLLECT_ITEST_COVERAGE =
|
||||||
EXEC_SUFFIX =
|
EXEC_SUFFIX =
|
||||||
COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc)
|
COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc)
|
||||||
NUM_ITEST_TRANCHES = 4
|
NUM_ITEST_TRANCHES = 4
|
||||||
|
@ -77,6 +79,12 @@ ifneq ($(tags),)
|
||||||
DEV_TAGS += ${tags}
|
DEV_TAGS += ${tags}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Enable integration test coverage (requires Go >= 1.20.0).
|
||||||
|
ifneq ($(cover),)
|
||||||
|
ITEST_COVERAGE = -cover
|
||||||
|
COLLECT_ITEST_COVERAGE = go tool covdata textfmt -i=itest/cover -o coverage.txt
|
||||||
|
endif
|
||||||
|
|
||||||
# Define the log tags that will be applied only when running unit tests. If none
|
# Define the log tags that will be applied only when running unit tests. If none
|
||||||
# are provided, we default to "nolog" which will be silent.
|
# are provided, we default to "nolog" which will be silent.
|
||||||
ifneq ($(log),)
|
ifneq ($(log),)
|
||||||
|
|
|
@ -16,6 +16,8 @@ shift
|
||||||
EXEC="$WORKDIR"/itest.test"$EXEC_SUFFIX"
|
EXEC="$WORKDIR"/itest.test"$EXEC_SUFFIX"
|
||||||
LND_EXEC="$WORKDIR"/lnd-itest"$EXEC_SUFFIX"
|
LND_EXEC="$WORKDIR"/lnd-itest"$EXEC_SUFFIX"
|
||||||
BTCD_EXEC="$WORKDIR"/btcd-itest"$EXEC_SUFFIX"
|
BTCD_EXEC="$WORKDIR"/btcd-itest"$EXEC_SUFFIX"
|
||||||
|
export GOCOVERDIR="$WORKDIR/cover"
|
||||||
|
mkdir -p "$GOCOVERDIR"
|
||||||
echo $EXEC -test.v "$@" -logoutput -logdir=.logs-tranche$TRANCHE -lndexec=$LND_EXEC -btcdexec=$BTCD_EXEC -splittranches=$NUM_TRANCHES -runtranche=$TRANCHE
|
echo $EXEC -test.v "$@" -logoutput -logdir=.logs-tranche$TRANCHE -lndexec=$LND_EXEC -btcdexec=$BTCD_EXEC -splittranches=$NUM_TRANCHES -runtranche=$TRANCHE
|
||||||
|
|
||||||
# Exit code 255 causes the parallel jobs to abort, so if one part fails the
|
# Exit code 255 causes the parallel jobs to abort, so if one part fails the
|
||||||
|
|
Loading…
Add table
Reference in a new issue