From f03e2425156996f1edd5943db5ebbdc9377c4a35 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Tue, 26 Nov 2024 22:13:48 +0800 Subject: [PATCH] chainntnfs: ensure previous test succeeded before running --- chainntnfs/bitcoindnotify/bitcoind_test.go | 12 ++++++++++-- chainntnfs/test/bitcoind/bitcoind_test.go | 6 +++++- chainntnfs/txnotifier_test.go | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/chainntnfs/bitcoindnotify/bitcoind_test.go b/chainntnfs/bitcoindnotify/bitcoind_test.go index fa51efa5ef..cf96a7cce4 100644 --- a/chainntnfs/bitcoindnotify/bitcoind_test.go +++ b/chainntnfs/bitcoindnotify/bitcoind_test.go @@ -109,11 +109,15 @@ func syncNotifierWithMiner(t *testing.T, notifier *BitcoindNotifier, // TestHistoricalConfDetailsTxIndex ensures that we correctly retrieve // historical confirmation details using the backend node's txindex. func TestHistoricalConfDetailsTxIndex(t *testing.T) { - t.Run("rpc polling enabled", func(st *testing.T) { + success := t.Run("rpc polling enabled", func(st *testing.T) { st.Parallel() testHistoricalConfDetailsTxIndex(st, true) }) + if !success { + return + } + t.Run("rpc polling disabled", func(st *testing.T) { st.Parallel() testHistoricalConfDetailsTxIndex(st, false) @@ -207,11 +211,15 @@ func testHistoricalConfDetailsTxIndex(t *testing.T, rpcPolling bool) { // historical confirmation details using the set of fallback methods when the // backend node's txindex is disabled. func TestHistoricalConfDetailsNoTxIndex(t *testing.T) { - t.Run("rpc polling enabled", func(st *testing.T) { + success := t.Run("rpc polling enabled", func(st *testing.T) { st.Parallel() testHistoricalConfDetailsNoTxIndex(st, true) }) + if !success { + return + } + t.Run("rpc polling disabled", func(st *testing.T) { st.Parallel() testHistoricalConfDetailsNoTxIndex(st, false) diff --git a/chainntnfs/test/bitcoind/bitcoind_test.go b/chainntnfs/test/bitcoind/bitcoind_test.go index cc379de817..b5a2e6626c 100644 --- a/chainntnfs/test/bitcoind/bitcoind_test.go +++ b/chainntnfs/test/bitcoind/bitcoind_test.go @@ -12,11 +12,15 @@ import ( // TestInterfaces executes the generic notifier test suite against a bitcoind // powered chain notifier. func TestInterfaces(t *testing.T) { - t.Run("bitcoind", func(st *testing.T) { + success := t.Run("bitcoind", func(st *testing.T) { st.Parallel() chainntnfstest.TestInterfaces(st, "bitcoind") }) + if !success { + return + } + t.Run("bitcoind rpc polling", func(st *testing.T) { st.Parallel() chainntnfstest.TestInterfaces(st, "bitcoind-rpc-polling") diff --git a/chainntnfs/txnotifier_test.go b/chainntnfs/txnotifier_test.go index 3ef276b42c..c7bc8da509 100644 --- a/chainntnfs/txnotifier_test.go +++ b/chainntnfs/txnotifier_test.go @@ -173,7 +173,7 @@ func TestTxNotifierRegistrationValidation(t *testing.T) { for _, testCase := range testCases { testCase := testCase - t.Run(testCase.name, func(t *testing.T) { + success := t.Run(testCase.name, func(t *testing.T) { hintCache := newMockHintCache() n := chainntnfs.NewTxNotifier( 10, chainntnfs.ReorgSafetyLimit, hintCache, hintCache, @@ -201,6 +201,10 @@ func TestTxNotifierRegistrationValidation(t *testing.T) { "\"%v\", got \"%v\"", testCase.err, err) } }) + + if !success { + return + } } }