From 500af3ceb014899d5cbea3e6b5a066622b1f56f6 Mon Sep 17 00:00:00 2001 From: Damian Ramirez Date: Tue, 21 Jan 2025 17:28:45 -0300 Subject: [PATCH] Move defer after error check --- chainio/clients/avsregistry/subscriber_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chainio/clients/avsregistry/subscriber_test.go b/chainio/clients/avsregistry/subscriber_test.go index 464940ec..3d4448bf 100644 --- a/chainio/clients/avsregistry/subscriber_test.go +++ b/chainio/clients/avsregistry/subscriber_test.go @@ -21,15 +21,15 @@ func TestSubscriberAvsRegistry(t *testing.T) { t.Run("subscribe to new pubkey registrations", func(t *testing.T) { pubKeyRegistrationsC, event, err := chainSubscriber.SubscribeToNewPubkeyRegistrations() - defer event.Unsubscribe() require.NoError(t, err) + defer event.Unsubscribe() // Emit a NewPubkeyRegistration event creating a new operator keypair, err := bls.NewKeyPairFromString("0x01") - require.NoError(t, err, "Failed to create BLS key pair") + require.NoError(t, err) ecdsaPrivateKey, err := crypto.HexToECDSA(testutils.ANVIL_FIRST_PRIVATE_KEY) - require.NoError(t, err, "Failed to parse ECDSA private key") + require.NoError(t, err) quorumNumbers := types.QuorumNums{0} @@ -56,8 +56,8 @@ func TestSubscriberAvsRegistry(t *testing.T) { t.Run("subscribe to operator socket updates", func(t *testing.T) { socketC, event, err := chainSubscriber.SubscribeToOperatorSocketUpdates() - defer event.Unsubscribe() require.NoError(t, err) + defer event.Unsubscribe() // Emit a SocketUpdate event socketUpdate := "socket-update" @@ -70,7 +70,7 @@ func TestSubscriberAvsRegistry(t *testing.T) { assert.Equal(t, socketUpdate, operatorSocketUpdate.Socket) case <-time.After(10 * time.Second): // Throw an error if the event is not received within 10 seconds, making the test fail - t.Fatal("Timed out waiting for NewPubkeyRegistration event") + t.Fatal("Timed out waiting for operatorSocketUpdate event") } }) }