Skip to content

Commit

Permalink
pool: Fix NPE in AIO test
Browse files Browse the repository at this point in the history
Payload reader is nil when error. Also replace `defer` with native test
cleaner.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
  • Loading branch information
cthulhu-rider committed Dec 4, 2024
1 parent fd1e188 commit ec6a6e2
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pool/pool_aio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,9 @@ func testPoolInterfaceWithAIO(t *testing.T, nodeAddr string) {
var cmd client.PrmObjectGet

hdr, read, err := pool.ObjectGetInit(ctxTimeout, containerID, objectID, signer, cmd)
defer func() {
_ = read.Close()
}()

require.NoError(t, err)
t.Cleanup(func() { _ = read.Close() })

require.False(t, hdr.Owner().IsZero())
require.True(t, hdr.Owner() == account)

Expand Down Expand Up @@ -498,11 +496,9 @@ func testPoolWaiterWithAIO(t *testing.T, nodeAddr string) {
var cmd client.PrmObjectGet

hdr, read, err := pool.ObjectGetInit(ctxTimeout, containerID, objectID, signer, cmd)
defer func() {
_ = read.Close()
}()

require.NoError(t, err)
t.Cleanup(func() { _ = read.Close() })

require.False(t, hdr.Owner().IsZero())
require.True(t, hdr.Owner() == account)

Expand Down Expand Up @@ -654,11 +650,9 @@ func testClientWaiterWithAIO(t *testing.T, nodeAddr string) {
var cmd client.PrmObjectGet

hdr, read, err := cl.ObjectGetInit(ctxTimeout, containerID, objectID, signer, cmd)
defer func() {
_ = read.Close()
}()

require.NoError(t, err)
t.Cleanup(func() { _ = read.Close() })

require.False(t, hdr.Owner().IsZero())
require.True(t, hdr.Owner() == account)

Expand Down

0 comments on commit ec6a6e2

Please sign in to comment.