diff --git a/Makefile b/Makefile index 97fdf15b5..9848b87c1 100644 --- a/Makefile +++ b/Makefile @@ -179,20 +179,6 @@ 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 diff --git a/itest/mint_batch_stress_test.go b/itest/mint_batch_stress_test.go index 38dd37745..eea9c2cee 100644 --- a/itest/mint_batch_stress_test.go +++ b/itest/mint_batch_stress_test.go @@ -34,11 +34,11 @@ func testMintBatch100StressTest(t *harnessTest) { } func testMintBatch1kStressTest(t *harnessTest) { - mintBatchStressTest(t, 1000, defaultWaitTimeout*10) + mintBatchStressTest(t, 1000, defaultWaitTimeout*20) } func testMintBatch10kStressTest(t *harnessTest) { - mintBatchStressTest(t, 10000, defaultWaitTimeout*100) + mintBatchStressTest(t, 10000, defaultWaitTimeout*200) } func mintBatchStressTest(t *harnessTest, batchSize int, diff --git a/itest/tapd_harness.go b/itest/tapd_harness.go index 4734f1e2f..2058e9006 100644 --- a/itest/tapd_harness.go +++ b/itest/tapd_harness.go @@ -34,6 +34,14 @@ var ( // to use when starting a tap daemon. dbbackend = flag.String("dbbackend", "sqlite", "Set the database "+ "backend to use when starting a tap daemon.") + + // postgresTimeout is a command line flag for specifying the amount of + // time to allow the postgres fixture to run in total. Needs to be + // increased for long-running tests. + postgresTimeout = flag.Duration("postgrestimeout", + tapdb.DefaultPostgresFixtureLifetime, "The amount of time to "+ + "allow the postgres fixture to run in total. Needs "+ + "to be increased for long-running tests.") ) const ( @@ -108,11 +116,11 @@ func newTapdHarness(ht *harnessTest, cfg tapdConfig, // We use the default settings, nothing to change for SQLite. case tapcfg.DatabaseBackendPostgres: - fixture := tapdb.NewTestPgFixture( - ht.t, tapdb.DefaultPostgresFixtureLifetime, - ) + fixture := tapdb.NewTestPgFixture(ht.t, *postgresTimeout) ht.t.Cleanup(func() { - fixture.TearDown(ht.t) + if !*noDelete { + fixture.TearDown(ht.t) + } }) tapCfg.DatabaseBackend = tapcfg.DatabaseBackendPostgres tapCfg.Postgres = fixture.GetConfig() diff --git a/make/testing_flags.mk b/make/testing_flags.mk index fe6c2b697..3dd2ff79d 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -35,6 +35,11 @@ ifneq ($(nodelete),) ITEST_FLAGS += -nodelete endif +# Run the optional tests. +ifneq ($(optional),) +ITEST_FLAGS += -optional -postgrestimeout=240m +endif + # Run itests with specified db backend. ifneq ($(dbbackend),) ITEST_FLAGS += -dbbackend=$(dbbackend) @@ -69,8 +74,12 @@ endif ifneq ($(timeout),) TEST_FLAGS += -test.timeout=$(timeout) else +ifneq ($(optional),) +TEST_FLAGS += -test.timeout=240m +else TEST_FLAGS += -test.timeout=60m endif +endif GOLIST := go list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/' GOLISTCOVER := $(shell go list -tags="$(DEV_TAGS)" -deps -f '{{.ImportPath}}' ./... | grep '$(PKG)' | sed -e 's/^$(ESCPKG)/./')