Skip to content

Commit

Permalink
multi: support optional itest cases
Browse files Browse the repository at this point in the history
In this commit, we add additional make commands to run optional itests,
where specific test cases are still specified with the 'icase' variable.
Additional optional itests are added in the same way as default itests.
We also remove the old-style build tags that were replaced with Go 1.17.
  • Loading branch information
jharveyb committed Jun 12, 2023
1 parent f46f3f1 commit cc90d7c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 10 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,20 @@ itest-only-trace: aperture-dir
rm -rf itest/regtest; date
$(GOTEST) ./itest -v -tags="$(ITEST_TAGS)" $(TEST_FLAGS) $(ITEST_FLAGS) -loglevel=trace -btcdexec=./btcd-itest -logdir=regtest

optional-itest: build-itest optional-itest-only

optional-itest-trace: build-itest optional-itest-only-trace

optional-itest-only: aperture-dir
@$(call print, "Running integration tests with ${backend} backend.")
rm -rf itest/regtest; date
$(GOTEST) ./itest -v -tags="$(ITEST_TAGS)" $(TEST_FLAGS) $(ITEST_FLAGS) -optional -btcdexec=./btcd-itest -logdir=regtest

optional-itest-only-trace: aperture-dir
@$(call print, "Running integration tests with ${backend} backend.")
rm -rf itest/regtest; date
$(GOTEST) ./itest -v -tags="$(ITEST_TAGS)" $(TEST_FLAGS) $(ITEST_FLAGS) -optional -loglevel=trace -btcdexec=./btcd-itest -logdir=regtest

aperture-dir:
ifeq ($(UNAME_S),Linux)
mkdir -p $$HOME/.aperture
Expand Down
17 changes: 13 additions & 4 deletions itest/integration_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//go:build itest
// +build itest

package itest

import (
"context"
"flag"
"fmt"
"testing"
"time"
Expand All @@ -14,12 +14,21 @@ import (
"github.com/stretchr/testify/require"
)

var optionalTests = flag.Bool("optional", false, "if true, the optional test"+
"list will be used")

// TestTaprootAssetsDaemon performs a series of integration tests amongst a
// programmatically driven set of participants, namely a Taproot Assets daemon
// and a universe server.
func TestTaprootAssetsDaemon(t *testing.T) {
// Switch to the list of optional test cases with the '-optional' flag.
testList := testCases
if *optionalTests {
testList = optionalTestCases
}

// If no tests are registered, then we can exit early.
if len(testCases) == 0 {
if len(testList) == 0 {
t.Skip("integration tests not selected with flag 'itest'")
}

Expand All @@ -41,8 +50,8 @@ func TestTaprootAssetsDaemon(t *testing.T) {

lndHarness.SetupStandbyNodes()

t.Logf("Running %v integration tests", len(testCases))
for _, testCase := range testCases {
t.Logf("Running %v integration tests", len(testList))
for _, testCase := range testList {
logLine := fmt.Sprintf("STARTING ============ %v ============\n",
testCase.name)

Expand Down
8 changes: 7 additions & 1 deletion itest/test_list_on_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build itest
// +build itest

package itest

Expand Down Expand Up @@ -129,3 +128,10 @@ var testCases = []*testCase{
test: testGetInfo,
},
}

var optionalTestCases = []*testCase{
{
name: "get info",
test: testGetInfo,
},
}
1 change: 0 additions & 1 deletion mssmt/bench_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !race
// +build !race

package mssmt_test

Expand Down
1 change: 0 additions & 1 deletion mssmt/tree_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !race
// +build !race

package mssmt_test

Expand Down
1 change: 0 additions & 1 deletion tapdb/test_postgres.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build test_db_postgres
// +build test_db_postgres

package tapdb

Expand Down
1 change: 0 additions & 1 deletion tapdb/test_sqlite.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !test_db_postgres
// +build !test_db_postgres

package tapdb

Expand Down
1 change: 0 additions & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build tools
// +build tools

package tapd

Expand Down

0 comments on commit cc90d7c

Please sign in to comment.