Skip to content

Commit dfef587

Browse files
authored
Merge pull request #179 from stanhu/sh-add-unit-test-multi-exec
Add unit test/comment for multi/exec handling
2 parents 26d3554 + 0de419c commit dfef587

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/redis_client/connection_mixin.rb

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def call_pipelined(commands, timeouts)
5050
timeout = timeouts && timeouts[index]
5151
result = read(timeout)
5252
@pending_reads -= 1
53+
54+
# A multi/exec command can return an array of results.
55+
# An error from a multi/exec command is handled in Multi#_coerce!.
5356
if result.is_a?(Error)
5457
result._set_command(commands[index])
5558
exception ||= result

test/shared/redis_client_tests.rb

+2
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,15 @@ def test_wrong_type
278278
pipeline.call("SISMEMBER", "str", "member")
279279
end
280280
end
281+
assert_equal ["SISMEMBER", "str", "member"], error.command
281282
assert_includes error.message, "WRONGTYPE Operation against a key holding the wrong kind of value"
282283

283284
error = assert_raises RedisClient::CommandError do
284285
@redis.multi do |transaction|
285286
transaction.call("SISMEMBER", "str", "member")
286287
end
287288
end
289+
assert_equal ["SISMEMBER", "str", "member"], error.command
288290
assert_includes error.message, "WRONGTYPE Operation against a key holding the wrong kind of value"
289291
end
290292

0 commit comments

Comments
 (0)