diff --git a/.golangci.yml b/.golangci.yml index 2c5092588..e6316815d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -27,6 +27,7 @@ run: - kvdb_etcd - kvdb_postgres - kvdb_sqlite + - integration linters-settings: govet: diff --git a/Makefile b/Makefile index 9e4b174dc..a45e86817 100644 --- a/Makefile +++ b/Makefile @@ -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.") diff --git a/aezeed/cipherseed_rpctest.go b/aezeed/cipherseed_integration.go similarity index 88% rename from aezeed/cipherseed_rpctest.go rename to aezeed/cipherseed_integration.go index 1fb25e31f..50d29cb79 100644 --- a/aezeed/cipherseed_rpctest.go +++ b/aezeed/cipherseed_integration.go @@ -1,5 +1,4 @@ -//go:build rpctest -// +build rpctest +//go:build integration package aezeed diff --git a/contractcourt/breacharbiter_test.go b/contractcourt/breacharbiter_test.go index 3dbbca3f9..263ab45ea 100644 --- a/contractcourt/breacharbiter_test.go +++ b/contractcourt/breacharbiter_test.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package contractcourt import ( diff --git a/contractcourt/nursery_store_test.go b/contractcourt/nursery_store_test.go index f82758901..ca537693c 100644 --- a/contractcourt/nursery_store_test.go +++ b/contractcourt/nursery_store_test.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package contractcourt import ( diff --git a/contractcourt/utxonursery_test.go b/contractcourt/utxonursery_test.go index 99b139ea4..3f5026ddc 100644 --- a/contractcourt/utxonursery_test.go +++ b/contractcourt/utxonursery_test.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package contractcourt import ( diff --git a/funding/config_rpctest.go b/funding/config_integration.go similarity index 90% rename from funding/config_rpctest.go rename to funding/config_integration.go index 44a2c939c..06bb6e173 100644 --- a/funding/config_rpctest.go +++ b/funding/config_integration.go @@ -1,4 +1,4 @@ -//go:build rpctest +//go:build integration package funding diff --git a/funding/manager_test.go b/funding/manager_test.go index dedbb2efa..f386e3de5 100644 --- a/funding/manager_test.go +++ b/funding/manager_test.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package funding import ( diff --git a/itest/list_off_test.go b/itest/list_off_test.go index c2e2f67aa..bb54b2546 100644 --- a/itest/list_off_test.go +++ b/itest/list_off_test.go @@ -1,5 +1,4 @@ -//go:build !rpctest -// +build !rpctest +//go:build !integration package itest diff --git a/itest/list_on_test.go b/itest/list_on_test.go index 7f2ed6f0d..4572a94f1 100644 --- a/itest/list_on_test.go +++ b/itest/list_on_test.go @@ -1,5 +1,4 @@ -//go:build rpctest -// +build rpctest +//go:build integration package itest diff --git a/itest/lnd_max_channel_size_test.go b/itest/lnd_max_channel_size_test.go index d795fb2e8..320ccabe4 100644 --- a/itest/lnd_max_channel_size_test.go +++ b/itest/lnd_max_channel_size_test.go @@ -1,6 +1,3 @@ -//go:build rpctest -// +build rpctest - package itest import ( diff --git a/itest/lnd_test.go b/itest/lnd_test.go index 195890ac2..5aa39f059 100644 --- a/itest/lnd_test.go +++ b/itest/lnd_test.go @@ -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. diff --git a/lncfg/address_test.go b/lncfg/address_test.go index a738523a8..2066aecc3 100644 --- a/lncfg/address_test.go +++ b/lncfg/address_test.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package lncfg import ( diff --git a/lncfg/protocol.go b/lncfg/protocol.go index 238e8c485..876b009c1 100644 --- a/lncfg/protocol.go +++ b/lncfg/protocol.go @@ -1,5 +1,4 @@ -//go:build !rpctest -// +build !rpctest +//go:build !integration package lncfg diff --git a/lncfg/protocol_rpctest.go b/lncfg/protocol_integration.go similarity index 97% rename from lncfg/protocol_rpctest.go rename to lncfg/protocol_integration.go index 7fca60f10..b2c64cb47 100644 --- a/lncfg/protocol_rpctest.go +++ b/lncfg/protocol_integration.go @@ -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 diff --git a/lnwallet/btcwallet/btcwallet_rpctest.go b/lnwallet/btcwallet/btcwallet_integration.go similarity index 90% rename from lnwallet/btcwallet/btcwallet_rpctest.go rename to lnwallet/btcwallet/btcwallet_integration.go index 938aef303..de53433f8 100644 --- a/lnwallet/btcwallet/btcwallet_rpctest.go +++ b/lnwallet/btcwallet/btcwallet_integration.go @@ -1,5 +1,4 @@ -//go:build rpctest || lowscrypt -// +build rpctest lowscrypt +//go:build integration || lowscrypt package btcwallet diff --git a/lnwallet/revocation_producer.go b/lnwallet/revocation_producer.go index fc8bde0fa..413e33d0a 100644 --- a/lnwallet/revocation_producer.go +++ b/lnwallet/revocation_producer.go @@ -1,5 +1,4 @@ -//go:build !rpctest -// +build !rpctest +//go:build !integration package lnwallet diff --git a/lnwallet/revocation_producer_itest.go b/lnwallet/revocation_producer_itest.go index 853a87760..d4b04152b 100644 --- a/lnwallet/revocation_producer_itest.go +++ b/lnwallet/revocation_producer_itest.go @@ -1,5 +1,4 @@ -//go:build rpctest -// +build rpctest +//go:build integration package lnwallet diff --git a/macaroons/security.go b/macaroons/security.go index cdc409b34..e4e3ffb9e 100644 --- a/macaroons/security.go +++ b/macaroons/security.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package macaroons import "github.com/btcsuite/btcwallet/snacl" diff --git a/macaroons/security_rpctest.go b/macaroons/security_integration.go similarity index 89% rename from macaroons/security_rpctest.go rename to macaroons/security_integration.go index 83792c383..f7d039fd0 100644 --- a/macaroons/security_rpctest.go +++ b/macaroons/security_integration.go @@ -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 -) +} diff --git a/make/testing_flags.mk b/make/testing_flags.mk index d18a04881..d17ae58a6 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -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) diff --git a/server_test.go b/server_test.go index a60d0d6a1..5c4bebca4 100644 --- a/server_test.go +++ b/server_test.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package lnd import ( diff --git a/sweep/defaults.go b/sweep/defaults.go index def74a3a2..2f53cdb0a 100644 --- a/sweep/defaults.go +++ b/sweep/defaults.go @@ -1,6 +1,3 @@ -//go:build !rpctest -// +build !rpctest - package sweep import ( diff --git a/sweep/defaults_rpctest.go b/sweep/defaults_rpctest.go deleted file mode 100644 index 24789de09..000000000 --- a/sweep/defaults_rpctest.go +++ /dev/null @@ -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 -)