Skip to content

Commit

Permalink
Merge pull request #127 from adjust/rpop-redis-nil
Browse files Browse the repository at this point in the history
Use redis.Nil in TestRedisClient.RPop
  • Loading branch information
psampaz authored Sep 22, 2022
2 parents 4630247 + f16cbd8 commit d6a5499
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test_redis_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"strings"
"sync"
"time"

"github.com/go-redis/redis/v8"
)

// TestRedisClient is a mock for redis
Expand Down Expand Up @@ -140,11 +142,11 @@ func (client *TestRedisClient) RPop(key string) (value string, err error) {
list, err := client.findList(key)
// not a list
if err != nil {
return "", ErrorNotFound
return "", err
}
// list is empty
if len(list) == 0 {
return "", ErrorNotFound
return "", redis.Nil
}

// Remove the last element of source (tail)
Expand Down

0 comments on commit d6a5499

Please sign in to comment.