multi: add new build tag integration

This commit adds a new build tag `integration` and removes the old tag
`rpctest` for clarity. Multiple unnecessary usages of `build !rpctest`
is also removed.
This commit is contained in:
yyforyongyu 2022-08-12 15:16:35 +08:00
parent d730797880
commit edba938996
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
24 changed files with 21 additions and 72 deletions

View File

@ -27,6 +27,7 @@ run:
- kvdb_etcd
- kvdb_postgres
- kvdb_sqlite
- integration
linters-settings:
govet:

View File

@ -93,19 +93,19 @@ build:
build-itest:
@$(call print, "Building itest btcd and lnd.")
CGO_ENABLED=0 $(GOBUILD) -tags="rpctest" -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
@$(call print, "Building itest binary for ${backend} backend.")
CGO_ENABLED=0 $(GOTEST) -v ./itest -tags="$(DEV_TAGS) $(RPC_TAGS) rpctest $(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)
build-itest-race:
@$(call print, "Building itest btcd and lnd with race detector.")
CGO_ENABLED=0 $(GOBUILD) -tags="rpctest" -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=1 $(GOBUILD) -race -tags="$(ITEST_TAGS)" -o itest/lnd-itest$(EXEC_SUFFIX) $(DEV_LDFLAGS) $(PKG)/cmd/lnd
@$(call print, "Building itest binary for ${backend} backend.")
CGO_ENABLED=0 $(GOTEST) -v ./itest -tags="$(DEV_TAGS) $(RPC_TAGS) rpctest $(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)
install:
@$(call print, "Installing lnd and lncli.")

View File

@ -1,5 +1,4 @@
//go:build rpctest
// +build rpctest
//go:build integration
package aezeed

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package contractcourt
import (

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package contractcourt
import (

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package contractcourt
import (

View File

@ -1,4 +1,4 @@
//go:build rpctest
//go:build integration
package funding

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package funding
import (

View File

@ -1,5 +1,4 @@
//go:build !rpctest
// +build !rpctest
//go:build !integration
package itest

View File

@ -1,5 +1,4 @@
//go:build rpctest
// +build rpctest
//go:build integration
package itest

View File

@ -1,6 +1,3 @@
//go:build rpctest
// +build rpctest
package itest
import (

View File

@ -57,7 +57,7 @@ var (
func TestLightningNetworkDaemon(t *testing.T) {
// If no tests are registered, then we can exit early.
if len(allTestCases) == 0 {
t.Skip("integration tests not selected with flag 'rpctest'")
t.Skip("integration tests not selected with flag 'integration'")
}
// Get the test cases to be run in this tranche.

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package lncfg
import (

View File

@ -1,5 +1,4 @@
//go:build !rpctest
// +build !rpctest
//go:build !integration
package lncfg

View File

@ -1,5 +1,4 @@
//go:build rpctest
// +build rpctest
//go:build integration
package lncfg
@ -7,6 +6,8 @@ package lncfg
// compatibility of protocol additions, while defaulting to the latest within
// lnd, or to enable experimental protocol changes.
//
// TODO(yy): delete this build flag to unify with `lncfg/protocol.go`.
//
//nolint:lll
type ProtocolOptions struct {
// LegacyProtocol is a sub-config that houses all the legacy protocol

View File

@ -1,5 +1,4 @@
//go:build rpctest || lowscrypt
// +build rpctest lowscrypt
//go:build integration || lowscrypt
package btcwallet

View File

@ -1,5 +1,4 @@
//go:build !rpctest
// +build !rpctest
//go:build !integration
package lnwallet

View File

@ -1,5 +1,4 @@
//go:build rpctest
// +build rpctest
//go:build integration
package lnwallet

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package macaroons
import "github.com/btcsuite/btcwallet/snacl"

View File

@ -1,15 +1,14 @@
//go:build rpctest
// +build rpctest
//go:build integration
package macaroons
import "github.com/btcsuite/btcwallet/waddrmgr"
var (
func init() {
// Below are the reduced scrypt parameters that are used when creating
// the encryption key for the macaroon database with snacl.NewSecretKey.
// We use very low values for our itest/rpctest to speed things up.
scryptN = waddrmgr.FastScryptOptions.N
scryptR = waddrmgr.FastScryptOptions.R
scryptP = waddrmgr.FastScryptOptions.P
)
}

View File

@ -115,4 +115,4 @@ backend = btcd
endif
# Construct the integration test command with the added build flags.
ITEST_TAGS := $(DEV_TAGS) $(RPC_TAGS) rpctest $(backend)
ITEST_TAGS := $(DEV_TAGS) $(RPC_TAGS) integration $(backend)

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package lnd
import (

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package sweep
import (

View File

@ -1,18 +0,0 @@
//go:build rpctest
// +build rpctest
package sweep
import (
"time"
)
var (
// DefaultBatchWindowDuration specifies duration of the sweep batch
// window. The sweep is held back during the batch window to allow more
// inputs to be added and thereby lower the fee per input.
//
// To speed up integration tests waiting for a sweep to happen, the
// batch window is shortened.
DefaultBatchWindowDuration = 8 * time.Second
)