-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #382 from deepfryed/feature/handle-elasticache-red…
…is-failover Handle AWS Elasticache Redis DNS failover.
- Loading branch information
Showing
4 changed files
with
104 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
defmodule ReadonlyReconnectTest do | ||
use ExUnit.Case | ||
import ExqTestUtil | ||
|
||
setup do | ||
Process.flag(:trap_exit, true) | ||
{:ok, redis} = Redix.start_link(host: "127.0.0.1", port: 6556) | ||
Process.register(redis, :testredis) | ||
|
||
on_exit(fn -> | ||
wait() | ||
TestRedis.teardown() | ||
end) | ||
|
||
{:ok, redis: redis} | ||
end | ||
|
||
test "disconnect on read-only errors with single command", %{redis: redis} do | ||
Exq.Redis.Connection.q(:testredis, ["SET", "key", "value"]) | ||
assert_received({:EXIT, pid, :killed}) | ||
assert redis == pid | ||
end | ||
|
||
test "disconnect on read-only errors with command pipeline", %{redis: redis} do | ||
Exq.Redis.Connection.qp(:testredis, [["GET", "key"], ["SET", "key", "value"]]) | ||
assert_received({:EXIT, pid, :killed}) | ||
assert redis == pid | ||
end | ||
|
||
test "disconnect on read-only errors with command pipeline returning values", %{redis: redis} do | ||
Exq.Redis.Connection.qp!(:testredis, [["GET", "key"], ["SET", "key", "value"]]) | ||
assert_received({:EXIT, pid, :killed}) | ||
assert redis == pid | ||
end | ||
|
||
test "pass through other errors" do | ||
assert {:error, %Redix.Error{}} = Exq.Redis.Connection.q(:testredis, ["GETS", "key"]) | ||
assert {:ok, [%Redix.Error{}]} = Exq.Redis.Connection.qp(:testredis, [["GETS", "key"]]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
port 6556 | ||
daemonize yes | ||
logfile stdout | ||
pidfile /tmp/resquex-redis-replica.pid | ||
slaveof 127.0.0.1 6555 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters