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
24 changed files with 21 additions and 72 deletions

View File

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

View File

@ -93,19 +93,19 @@ build:
build-itest: build-itest:
@$(call print, "Building itest btcd and lnd.") @$(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 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.") @$(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: build-itest-race:
@$(call print, "Building itest btcd and lnd with race detector.") @$(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 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.") @$(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: install:
@$(call print, "Installing lnd and lncli.") @$(call print, "Installing lnd and lncli.")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@ var (
func TestLightningNetworkDaemon(t *testing.T) { func TestLightningNetworkDaemon(t *testing.T) {
// If no tests are registered, then we can exit early. // If no tests are registered, then we can exit early.
if len(allTestCases) == 0 { 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. // Get the test cases to be run in this tranche.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -115,4 +115,4 @@ backend = btcd
endif endif
# Construct the integration test command with the added build flags. # 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 package lnd
import ( import (

View File

@ -1,6 +1,3 @@
//go:build !rpctest
// +build !rpctest
package sweep package sweep
import ( 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
)