Skip to content

Commit

Permalink
Check if connection in nil before closing in acl module tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinmwinuka committed Apr 4, 2024
1 parent 2ea30d2 commit 2af4db5
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions pkg/modules/acl/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ func Test_HandleAuth(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()
r := resp.NewConn(conn)

Expand Down Expand Up @@ -288,7 +290,9 @@ func Test_HandleCat(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()
r := resp.NewConn(conn)

Expand Down Expand Up @@ -405,7 +409,9 @@ func Test_HandleUsers(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()

r := resp.NewConn(conn)
Expand Down Expand Up @@ -458,7 +464,9 @@ func Test_HandleSetUser(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()

r := resp.NewConn(conn)
Expand Down Expand Up @@ -1044,7 +1052,9 @@ func Test_HandleGetUser(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()

r := resp.NewConn(conn)
Expand Down Expand Up @@ -1190,7 +1200,9 @@ func Test_HandleDelUser(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()

r := resp.NewConn(conn)
Expand Down Expand Up @@ -1261,7 +1273,9 @@ func Test_HandleWhoAmI(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()

r := resp.NewConn(conn)
Expand Down Expand Up @@ -1331,7 +1345,9 @@ func Test_HandleList(t *testing.T) {
t.Error(err)
}
defer func() {
_ = conn.Close()
if conn != nil {
_ = conn.Close()
}
}()

r := resp.NewConn(conn)
Expand Down

0 comments on commit 2af4db5

Please sign in to comment.