mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
make+graph/db: add -short helper and skip tests in short mode
In this commit, we add a makefile helper that can be used to add the "-short" flag to the "go test" command when running unit tests via "make unit ...". Tests can then be expanded with a `testing.Short()` check to potentially skip the test in short mode. This is useful for if a dev wants to quickly run most of the tests in a package but would like to opt out of running the longer form tests such as stress tests or rapid generation tests. This commit adds this check to two graph/db tests.
This commit is contained in:
@@ -2510,6 +2510,11 @@ func TestFilterKnownChanIDs(t *testing.T) {
|
|||||||
// methods that acquire the cache mutex along with the DB mutex.
|
// methods that acquire the cache mutex along with the DB mutex.
|
||||||
func TestStressTestChannelGraphAPI(t *testing.T) {
|
func TestStressTestChannelGraphAPI(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skipf("Skipping test in short mode")
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
graph := MakeTestGraph(t)
|
graph := MakeTestGraph(t)
|
||||||
|
@@ -1177,6 +1177,10 @@ func assertResultState(t *testing.T, sql *SQLStore, expState dbState) {
|
|||||||
func TestMigrateGraphToSQLRapid(t *testing.T) {
|
func TestMigrateGraphToSQLRapid(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skipf("skipping test in short mode")
|
||||||
|
}
|
||||||
|
|
||||||
dbFixture := NewTestDBFixture(t)
|
dbFixture := NewTestDBFixture(t)
|
||||||
|
|
||||||
rapid.Check(t, func(rt *rapid.T) {
|
rapid.Check(t, func(rt *rapid.T) {
|
||||||
|
@@ -121,6 +121,12 @@ ifneq ($(nocache),)
|
|||||||
TEST_FLAGS += -test.count=1
|
TEST_FLAGS += -test.count=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# If the short flag is added, then any unit tests marked with "testing.Short()"
|
||||||
|
# will be skipped.
|
||||||
|
ifneq ($(short),)
|
||||||
|
TEST_FLAGS += -short
|
||||||
|
endif
|
||||||
|
|
||||||
GOLIST := $(GOCC) list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
|
GOLIST := $(GOCC) list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
|
||||||
|
|
||||||
# UNIT_TARGTED is undefined iff a specific package and/or unit test case is
|
# UNIT_TARGTED is undefined iff a specific package and/or unit test case is
|
||||||
|
Reference in New Issue
Block a user