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))