debasishg / scala-redis

A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side.
1.02k stars 219 forks source link

Issue #293 Unit tests demonstrating that BATCH mode redis client does not properly authenticate #292

Open noahlz opened 2 years ago

noahlz commented 2 years ago

I'm investigating an issue similar to Issue #282 and decided to add a unit test that demonstrates how the RedisClientPool supports Authentication.

noahlz commented 2 years ago
[info] SecurePoolSpec:
[info] redis pools with authentication
[info] - should be able to connect as normal
[info] ad-hoc clients connecting to a secure redis server
[info] - should be rejected for no password
[info] - should be rejected for wrong password
noahlz commented 2 years ago
[info] SecureBatchedPipelineSpec:
[info] a redis client in batch mode connecting to a password-protected redis instance
[info] - should be able to connect to the instance *** FAILED ***
[info]   An unexpected java.lang.Exception was thrown. (PipelineSpec.scala:388)
[info] - should be rejected when it is not initialized with a password
[info] - should be rejected when it is initialized with an incorrect password
[info] com.redis.SecureBatchedPipelineSpec *** ABORTED ***
[info]   java.lang.Exception: NOAUTH Authentication required.
[info]   at com.redis.Reply$$anonfun$errReply$1.applyOrElse(RedisProtocol.scala:132)
[info]   at com.redis.Reply$$anonfun$errReply$1.applyOrElse(RedisProtocol.scala:131)
[info]   at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:35)
[info]   at com.redis.Reply$$anonfun$singleLineReply$1.applyOrElse(RedisProtocol.scala:77)
[info]   at com.redis.Reply$$anonfun$singleLineReply$1.applyOrElse(RedisProtocol.scala:77)
[info]   at scala.PartialFunction$OrElse.apply(PartialFunction.scala:266)
[info]   at com.redis.Reply$$anonfun$integerReply$1.applyOrElse(RedisProtocol.scala:67)
[info]   at com.redis.Reply$$anonfun$integerReply$1.applyOrElse(RedisProtocol.scala:67)
[info]   at scala.PartialFunction$OrElse.apply(PartialFunction.scala:266)
[info]   at com.redis.Reply.receive(RedisProtocol.scala:152)
[info]   ...
noahlz commented 2 years ago

These unit tests expose #293