Skip to content

Commit

Permalink
Merge pull request #1026 from paradiseng/redis_password
Browse files Browse the repository at this point in the history
Fix redis auth failed when poolsize > 1
  • Loading branch information
farirat committed Feb 21, 2022
2 parents 3cd5ed5 + 1569ba6 commit b0e3aaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jasmin/redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def clientConnectionFailed(self, connector, reason):

def __init__(self, uuid, dbid, poolsize, isLazy=True,
handler=redis.ConnectionHandler, config=None):
redis.RedisFactory.__init__(self, uuid, dbid, poolsize, isLazy, handler)
redis.RedisFactory.__init__(self, uuid, dbid, poolsize, isLazy, handler, password=config.password)

# Set up a dedicated logger
self.log = logging.getLogger(LOG_CATEGORY)
Expand Down
9 changes: 8 additions & 1 deletion tests/redis/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def tearDown(self):
yield self.redisClient.disconnect()


class DataTestCase(RedisTestCase):
class DataTestCase(object):
@defer.inlineCallbacks
def test_set_get_string(self):
yield self.redisClient.set('foo', 'bar')
Expand Down Expand Up @@ -116,3 +116,10 @@ def test_hmset_expiry(self):
# Redis key must be expired
g = yield self.redisClient.hgetall('h_test')
self.assertEqual(g, {})

class DataTestCaseWithAuth(AuthenticationTestCase, DataTestCase):
pass


class DataTestCaseNoAuth(RedisTestCase, DataTestCase):
pass

0 comments on commit b0e3aaa

Please sign in to comment.