From 604a355db6f1219647f9d9cb7c5378dcbda445be Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Sat, 27 Aug 2022 15:09:02 +0800 Subject: [PATCH] lnd: replace defer cleanup with `t.Cleanup` Signed-off-by: Eng Zer Jun --- server_test.go | 2 +- witness_beacon_test.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server_test.go b/server_test.go index 41954d1c1..6c570e332 100644 --- a/server_test.go +++ b/server_test.go @@ -75,7 +75,7 @@ func TestTLSAutoRegeneration(t *testing.T) { if err != nil { t.Fatalf("couldn't retrieve TLS config") } - defer cleanUp() + t.Cleanup(cleanUp) // Grab the certificate to test that getTLSConfig did its job correctly // and generated a new cert. diff --git a/witness_beacon_test.go b/witness_beacon_test.go index 5f58eeac1..d98c276f5 100644 --- a/witness_beacon_test.go +++ b/witness_beacon_test.go @@ -37,8 +37,7 @@ func TestWitnessBeaconIntercept(t *testing.T) { []byte{2}, ) require.NoError(t, err) - - defer subscription.CancelSubscription() + t.Cleanup(subscription.CancelSubscription) require.NoError(t, interceptedFwd.Settle(preimage))