diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e71f2d..f990d7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,19 +18,21 @@ jobs: strategy: matrix: include: - - elixir: 1.14.x - otp: 25.x + - elixir: 1.16.x + otp: 26.x os: 'ubuntu-latest' style: true coverage: true dialyzer: true - - elixir: 1.13.x + - elixir: 1.15.x + otp: 26.x + os: 'ubuntu-latest' + - elixir: 1.14.x otp: 24.x os: 'ubuntu-latest' - - elixir: 1.11.x + - elixir: 1.12.x otp: 23.x os: 'ubuntu-20.04' - inch-report: true env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..587170b --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +elixir 1.16.1 +erlang 26.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6763311..fa88e08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.3.2](https://github.com/cabol/nebulex_redis_adapter/tree/v2.3.2) (2024-02-11) + +[Full Changelog](https://github.com/cabol/nebulex_redis_adapter/compare/v2.3.1...v2.3.2) + +**Closed issues:** + +- Consistently getting MOVED error with a cluster + [#55](https://github.com/cabol/nebulex_redis_adapter/issues/55) + +**Merged pull requests:** + +- Handle multiple slot ranges + [#58](https://github.com/cabol/nebulex_redis_adapter/pull/58) + ([dongfuye](https://github.com/dongfuye)) +- Support tuples as keys for `get_all/put_all` callbacks in Redis/Client cluster + [#57](https://github.com/cabol/nebulex_redis_adapter/pull/57) + ([DanielKulesza](https://github.com/DanielKulesza)) + ## [v2.3.1](https://github.com/cabol/nebulex_redis_adapter/tree/v2.3.1) (2023-08-05) [Full Changelog](https://github.com/cabol/nebulex_redis_adapter/compare/v2.3.0...v2.3.1) diff --git a/README.md b/README.md index fc26f3b..f5b3a82 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ defp deps do [ {:nebulex_redis_adapter, "~> 2.3"}, {:crc, "~> 0.10"}, #=> Needed when using Redis Cluster - {:jchash, "~> 0.1.3"} #=> Needed when using consistent-hashing + {:jchash, "~> 0.1.4"} #=> Needed when using consistent-hashing ] end ``` diff --git a/config/test.exs b/config/test.exs index 6527114..b06680e 100644 --- a/config/test.exs +++ b/config/test.exs @@ -75,7 +75,7 @@ config :nebulex_redis_adapter, NebulexRedisAdapter.TestCache.RedisClusterWithKey # Configuration endpoints configuration_endpoints: [ endpoint1_conn_opts: [ - url: "redis://127.0.0.1:7000" + url: "redis://127.0.0.1:10000" ] ], # Overrides the master host with the config endpoint, in this case with diff --git a/docker-compose.yml b/docker-compose.yml index 8b43a87..e022906 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,9 +30,9 @@ services: - redis_net redis-cluster: - image: grokzen/redis-cluster:6.2.10 + image: grokzen/redis-cluster:6.2.11 ports: - - '7000-7005:7000-7005' + - '10000-10005:7000-7005' environment: - 'REDIS_CLUSTER_IP=0.0.0.0' @@ -125,6 +125,7 @@ volumes: redis-node-4-data: redis-node-5-data: + networks: redis_net: driver: bridge diff --git a/lib/nebulex_redis_adapter/command.ex b/lib/nebulex_redis_adapter/command.ex index 5c6f973..f507c11 100644 --- a/lib/nebulex_redis_adapter/command.ex +++ b/lib/nebulex_redis_adapter/command.ex @@ -23,6 +23,7 @@ defmodule NebulexRedisAdapter.Command do Keyword.t() ) :: {:ok, term} | {:error, term} def exec(adapter_meta, command, key \\ nil, opts \\ []) do + # TODO: Handle errors; especially for :redis_cluster mode adapter_meta |> conn(key, opts) |> Redix.command(command, redis_command_opts(opts)) @@ -72,6 +73,7 @@ defmodule NebulexRedisAdapter.Command do Keyword.t() ) :: {:ok, [term]} | {:error, term} def pipeline(adapter_meta, commands, key \\ nil, opts \\ []) do + # TODO: Handle errors; especially for :redis_cluster mode adapter_meta |> conn(key, opts) |> Redix.pipeline(commands, redis_command_opts(opts)) diff --git a/lib/nebulex_redis_adapter/redis_cluster.ex b/lib/nebulex_redis_adapter/redis_cluster.ex index 8ef58a9..949f899 100644 --- a/lib/nebulex_redis_adapter/redis_cluster.ex +++ b/lib/nebulex_redis_adapter/redis_cluster.ex @@ -148,7 +148,7 @@ defmodule NebulexRedisAdapter.RedisCluster do |> :persistent_term.erase() end - @spec with_retry(atom, pos_integer, (() -> term)) :: term + @spec with_retry(atom, pos_integer, (-> term)) :: term def with_retry(name, retries, fun) do with_retry(name, fun, retries, 1) end diff --git a/mix.exs b/mix.exs index 6bc0baf..172d19c 100644 --- a/mix.exs +++ b/mix.exs @@ -2,15 +2,15 @@ defmodule NebulexRedisAdapter.MixProject do use Mix.Project @source_url "https://github.com/cabol/nebulex_redis_adapter" - @version "2.3.1" - @nbx_tag "2.5.2" - @nbx_vsn "2.5" + @version "2.3.2" + @nbx_tag "2.6.0" + @nbx_vsn "2.6" def project do [ app: :nebulex_redis_adapter, version: @version, - elixir: "~> 1.9", + elixir: "~> 1.12", elixirc_paths: elixirc_paths(Mix.env()), aliases: aliases(), deps: deps(), @@ -50,24 +50,24 @@ defmodule NebulexRedisAdapter.MixProject do defp deps do [ nebulex_dep(), - {:redix, "~> 1.2"}, + {:redix, "~> 1.3"}, {:nimble_options, "~> 0.5 or ~> 1.0"}, {:crc, "~> 0.10", optional: true}, {:jchash, "~> 0.1", optional: true}, {:telemetry, "~> 0.4 or ~> 1.0", optional: true}, # Test & Code Analysis - {:excoveralls, "~> 0.16", only: :test}, - {:credo, "~> 1.6", only: [:dev, :test], runtime: false}, - {:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false}, + {:excoveralls, "~> 0.18", only: :test}, + {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, + {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, {:mimic, "~> 1.7", only: :test}, # Benchmark Test - {:benchee, "~> 1.1", only: :test}, + {:benchee, "~> 1.3", only: :test}, {:benchee_html, "~> 1.0", only: :test}, # Docs - {:ex_doc, "~> 0.29", only: [:dev, :test], runtime: false} + {:ex_doc, "~> 0.31", only: [:dev, :test], runtime: false} ] end diff --git a/mix.lock b/mix.lock index 2b03552..dc52396 100644 --- a/mix.lock +++ b/mix.lock @@ -1,36 +1,28 @@ %{ - "benchee": {:hex, :benchee, "1.1.0", "f3a43817209a92a1fade36ef36b86e1052627fd8934a8b937ac9ab3a76c43062", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}], "hexpm", "7da57d545003165a012b587077f6ba90b89210fd88074ce3c60ce239eb5e6d93"}, - "benchee_html": {:hex, :benchee_html, "1.0.0", "5b4d24effebd060f466fb460ec06576e7b34a00fc26b234fe4f12c4f05c95947", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:benchee_json, "~> 1.0", [hex: :benchee_json, repo: "hexpm", optional: false]}], "hexpm", "5280af9aac432ff5ca4216d03e8a93f32209510e925b60e7f27c33796f69e699"}, + "benchee": {:hex, :benchee, "1.3.0", "f64e3b64ad3563fa9838146ddefb2d2f94cf5b473bdfd63f5ca4d0657bf96694", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "34f4294068c11b2bd2ebf2c59aac9c7da26ffa0068afdf3419f1b176e16c5f81"}, + "benchee_html": {:hex, :benchee_html, "1.0.1", "1e247c0886c3fdb0d3f4b184b653a8d6fb96e4ad0d0389267fe4f36968772e24", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:benchee_json, "~> 1.0", [hex: :benchee_json, repo: "hexpm", optional: false]}], "hexpm", "b00a181af7152431901e08f3fc9f7197ed43ff50421a8347b0c80bf45d5b3fef"}, "benchee_json": {:hex, :benchee_json, "1.0.0", "cc661f4454d5995c08fe10dd1f2f72f229c8f0fb1c96f6b327a8c8fc96a91fe5", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "da05d813f9123505f870344d68fb7c86a4f0f9074df7d7b7e2bb011a63ec231c"}, - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, - "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "crc": {:hex, :crc, "0.10.5", "ee12a7c056ac498ef2ea985ecdc9fa53c1bfb4e53a484d9f17ff94803707dfd8", [:mix, :rebar3], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3e673b6495a9525c5c641585af1accba59a1eb33de697bedf341e247012c2c7f"}, - "credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "6839fcf63d1f0d1c0f450abc8564a57c43d644077ab96f2934563e68b8a769d7"}, + "credo": {:hex, :credo, "1.7.4", "68ca5cf89071511c12fd9919eb84e388d231121988f6932756596195ccf7fd35", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9cf776d062c78bbe0f0de1ecaee183f18f2c3ec591326107989b054b7dddefc2"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, - "dialyxir": {:hex, :dialyxir, "1.3.0", "fd1672f0922b7648ff9ce7b1b26fcf0ef56dda964a459892ad15f6b4410b5284", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "00b2a4bcd6aa8db9dcb0b38c1225b7277dca9bc370b6438715667071a304696f"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.33", "3c3fd9673bb5dcc9edc28dd90f50c87ce506d1f71b70e3de69aa8154bc695d44", [:mix], [], "hexpm", "2d526833729b59b9fdb85785078697c72ac5e5066350663e5be6a1182da61b8f"}, - "elixir_make": {:hex, :elixir_make, "0.7.7", "7128c60c2476019ed978210c245badf08b03dbec4f24d05790ef791da11aa17c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "5bc19fff950fad52bbe5f211b12db9ec82c6b34a9647da0c2224b8b8464c7e6c"}, + "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, + "elixir_make": {:hex, :elixir_make, "0.7.8", "505026f266552ee5aabca0b9f9c229cbb496c689537c9f922f3eb5431157efc7", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "7a71945b913d37ea89b06966e1342c85cfe549b15e6d6d081e8081c493062c07"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_doc": {:hex, :ex_doc, "0.30.4", "e8395c8e3c007321abb30a334f9f7c0858d80949af298302daf77553468c0c39", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "9a19f0c50ffaa02435668f5242f2b2a61d46b541ebf326884505dfd3dd7af5e4"}, - "excoveralls": {:hex, :excoveralls, "0.16.1", "0bd42ed05c7d2f4d180331a20113ec537be509da31fed5c8f7047ce59ee5a7c5", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "dae763468e2008cf7075a64cb1249c97cb4bc71e236c5c2b5e5cdf1cfa2bf138"}, - "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, - "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, - "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, + "ex_doc": {:hex, :ex_doc, "0.31.1", "8a2355ac42b1cc7b2379da9e40243f2670143721dd50748bf6c3b1184dae2089", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "3178c3a407c557d8343479e1ff117a96fd31bafe52a039079593fb0524ef61b0"}, + "excoveralls": {:hex, :excoveralls, "0.18.0", "b92497e69465dc51bc37a6422226ee690ab437e4c06877e836f1c18daeb35da9", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1109bb911f3cb583401760be49c02cbbd16aed66ea9509fc5479335d284da60b"}, + "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, "jchash": {:hex, :jchash, "0.1.4", "996eaef8217764c5edb6c75bea87ec4e48534b5ba8ed233b5da1726583bbe348", [:rebar3], [], "hexpm", "f0d739cd75b2b9ff44b242b1912afb9fa44361102e76509098a0922bf4a511ed"}, - "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, + "makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, - "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.4", "29563475afa9b8a2add1b7a9c8fb68d06ca7737648f28398e04461f008b69521", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f4ed47ecda66de70dd817698a703f8816daa91272e7e45812469498614ae8b29"}, "mimic": {:hex, :mimic, "1.7.4", "cd2772ffbc9edefe964bc668bfd4059487fa639a5b7f1cbdf4fd22946505aa4f", [:mix], [], "hexpm", "437c61041ecf8a7fae35763ce89859e4973bb0666e6ce76d75efc789204447c3"}, - "nebulex": {:hex, :nebulex, "2.5.2", "2d358813ccb2eeea525e3a29c270ad123d3337e97ed9159d9113cf128108bd4c", [:mix], [{:decorator, "~> 1.4", [hex: :decorator, repo: "hexpm", optional: true]}, {:shards, "~> 1.1", [hex: :shards, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "61a122302cf42fa61eca22515b1df21aaaa1b98cf462f6dd0998de9797aaf1c7"}, - "nimble_options": {:hex, :nimble_options, "1.0.2", "92098a74df0072ff37d0c12ace58574d26880e522c22801437151a159392270e", [:mix], [], "hexpm", "fd12a8db2021036ce12a309f26f564ec367373265b53e25403f0ee697380f1b8"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, - "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, - "redix": {:hex, :redix, "1.2.3", "3036e7c6080c42e1bbaa9168d1e28e367b01e8960a640a899b8ef8067273cb5e", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:nimble_options, "~> 0.5.0 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "14e2bca8a03fad297a78a3d201032df260ee5f0e0ef9c173c0f9ca5b3e0331b7"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, + "nebulex": {:hex, :nebulex, "2.6.0", "6e581c0b53aab80a1431488d367a41c6a8ee53763f86e7a7a6754ee571ecfdab", [:mix], [{:decorator, "~> 1.4", [hex: :decorator, repo: "hexpm", optional: true]}, {:shards, "~> 1.1", [hex: :shards, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "cf4a0040bd6d58b8d0204f668641973520fdbd78bd8618e1cdb7a11e7bc560cf"}, + "nimble_options": {:hex, :nimble_options, "1.1.0", "3b31a57ede9cb1502071fade751ab0c7b8dbe75a9a4c2b5bbb0943a690b63172", [:mix], [], "hexpm", "8bbbb3941af3ca9acc7835f5655ea062111c9c27bcac53e004460dfd19008a99"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, + "redix": {:hex, :redix, "1.3.0", "f4121163ff9d73bf72157539ff23b13e38422284520bb58c05e014b19d6f0577", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:nimble_options, "~> 0.5.0 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "60d483d320c77329c8cbd3df73007e51b23f3fae75b7693bc31120d83ab26131"}, "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } diff --git a/test/nebulex_redis_adapter/redis_cluster_test.exs b/test/nebulex_redis_adapter/redis_cluster_test.exs index b5f1ccd..ba1c30a 100644 --- a/test/nebulex_redis_adapter/redis_cluster_test.exs +++ b/test/nebulex_redis_adapter/redis_cluster_test.exs @@ -90,7 +90,7 @@ defmodule NebulexRedisAdapter.RedisClusterTest do configuration_endpoints: [ endpoint1_conn_opts: [ host: "127.0.0.1", - port: 7000 + port: 10_000 ] ], override_master_host: true @@ -116,7 +116,7 @@ defmodule NebulexRedisAdapter.RedisClusterTest do configuration_endpoints: [ endpoint1_conn_opts: [ host: "127.0.0.1", - port: 7000 + port: 10_000 ] ], override_master_host: true diff --git a/test/shared/cache/command_test.exs b/test/shared/cache/command_test.exs index d45ce67..c307be5 100644 --- a/test/shared/cache/command_test.exs +++ b/test/shared/cache/command_test.exs @@ -2,9 +2,15 @@ defmodule NebulexRedisAdapter.Cache.CommandTest do import Nebulex.CacheCase deftests "Redis" do - test "command/3 executes a command", %{cache: cache} do - assert cache.command(["SET", "foo", "bar"], timeout: 5000) == {:ok, "OK"} - assert cache.command(["GET", "foo"]) == {:ok, "bar"} + alias Nebulex.Adapter + + test "command/3 executes a command", %{cache: cache, name: name} do + mode = Adapter.with_meta(name, fn _, %{mode: mode} -> mode end) + + if mode != :redis_cluster do + assert cache.command(["SET", "foo", "bar"], timeout: 5000) == {:ok, "OK"} + assert cache.command(["GET", "foo"]) == {:ok, "bar"} + end end test "command/3 returns an error", %{cache: cache} do @@ -23,16 +29,20 @@ defmodule NebulexRedisAdapter.Cache.CommandTest do assert cache.command!(["LRANGE", "mylist", "0", "-1"], key: "mylist") == ["hello", "world"] end - test "pipeline/3 runs the piped commands", %{cache: cache} do - assert cache.pipeline( - [ - ["LPUSH", "mylist", "world"], - ["LPUSH", "mylist", "hello"], - ["LRANGE", "mylist", "0", "-1"] - ], - key: "mylist", - timeout: 5000 - ) == {:ok, [1, 2, ["hello", "world"]]} + test "pipeline/3 runs the piped commands", %{cache: cache, name: name} do + mode = Adapter.with_meta(name, fn _, %{mode: mode} -> mode end) + + if mode != :redis_cluster do + assert cache.pipeline( + [ + ["LPUSH", "mylist", "world"], + ["LPUSH", "mylist", "hello"], + ["LRANGE", "mylist", "0", "-1"] + ], + key: "mylist", + timeout: 5000 + ) == {:ok, [1, 2, ["hello", "world"]]} + end end test "pipeline/3 returns an error", %{cache: cache} do