Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the MOVE command to finagle-redis. #267

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added additional tests for redis MOVE command.
Additional testing was requested for the finagle-redis MOVE command impl.
Added tests to the ClientSpec and the ClientServerSpec.
  • Loading branch information
penland365 committed May 6, 2014
commit 104126fec083f6839279ef5f2423889e042a5a4f
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,21 @@ class ClientServerIntegrationSpec extends SpecificationWithJUnit {
Await.result(client(Type(KEY))) mustEqual StatusReply("string")
Await.result(client(Type("nosuchkey"))) mustEqual StatusReply("none")
}
"MOVE" >> {
val fromDb = 14
val toDb = 15
Await.result(client(Select(toDb))) mustEqual StatusReply("OK")
Await.result(client(Del(List(KEY)))) // only ensuring clean slate, reply doesn't matter
Await.result(client(Select(fromDb))) mustEqual StatusReply("OK")
Await.result(client(Set("MOO", "BAR"))) mustEqual StatusReply("OK")

Await.result(client(Move("", StringToChannelBuffer(toDb.toString)))) must throwA[ClientError]
Await.result(client(Move("MOO", StringToChannelBuffer("")))) must throwA[ClientError]
Await.result(client(Move(StringToChannelBuffer("MOO"),
StringToChannelBuffer(toDb.toString)))) mustEqual IntegerReply(1)
Await.result(client(Move(StringToChannelBuffer("MOO"),
StringToChannelBuffer(toDb.toString)))) mustEqual IntegerReply(0)
}
}

"Handle Sorted Set Commands" >> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,19 @@ class ClientSpec extends SpecificationWithJUnit {
Await.result(client.pTtl(foo)) map (_ must beLessThanOrEqualTo(20000L))
}

"move" in {
val fromDb = 14
val toDb = 15
Await.result(client.select(toDb))
Await.result(client.del(Seq(foo)))
Await.result(client.select(fromDb))

Await.result(client.move(foo, bar)) mustEqual false
Await.result(client.set(foo, bar))
Await.result(client.move(foo, StringToChannelBuffer(toDb.toString))) mustEqual true
Await.result(client.del(Seq(foo)))
}

// Once the scan/hscan pull request gets merged into Redis master,
// the tests can be uncommented.
// "scan" in {
Expand Down