From 2714ef6f9bfc0128293b2353c271dc9104cd84b5 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Mon, 24 Jun 2024 15:44:29 +0900 Subject: [PATCH] Elixir 1.17 support in CI (#369) --- .github/workflows/main.yml | 68 +++++++++++++++----------------------- docker-compose.yml | 2 -- lib/xandra/protocol/v3.ex | 2 +- lib/xandra/protocol/v4.ex | 2 +- lib/xandra/protocol/v5.ex | 2 +- mix.exs | 2 +- mix.lock | 30 ++++++++--------- test/xandra_test.exs | 12 ++++--- 8 files changed, 53 insertions(+), 67 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 06712dd3..ddf161a6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: lint: name: Lint - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: true @@ -26,12 +26,12 @@ jobs: - name: Install OTP and Elixir uses: erlef/setup-beam@v1 with: - otp-version: "26.2" - elixir-version: "1.16" + otp-version: "27.0" + elixir-version: "1.17.1" - name: Cache dependencies id: cache-deps - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | deps @@ -43,7 +43,7 @@ jobs: - name: Install and compile dependencies if: steps.cache-deps.outputs.cache-hit != 'true' - run: mix do deps.get + deps.compile + run: mix deps.get --check-locked - name: Check formatting run: mix format --check-formatted @@ -56,7 +56,7 @@ jobs: run: mix compile --warnings-as-errors --force - name: Cache Dialyzer's PLT - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-plt with: path: priv/plts @@ -75,41 +75,30 @@ jobs: test: name: >- - Test (Elixir ${{ matrix.elixir }}, - OTP ${{ matrix.otp }}, + Test (Elixir ${{ matrix.runtime.elixir }}, + OTP ${{ matrix.runtime.otp }} — C* ${{ matrix.server_versions.cassandra }}, - Scylla ${{ matrix.server_versions.scylla }} (coverage: ${{ matrix.coverage }}) + Scylla ${{ matrix.server_versions.scylla }}) - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - otp: - - "25.3" - elixir: - - "1.16" - server_versions: - - cassandra: "3" - scylla: "4.6.3" - - include: - - otp: "26.2" - elixir: "1.16" - coverage: true - server_versions: - cassandra: "4.1" - scylla: "5.2" - - # Oldest-supported Elixir and Erlang versions. + runtime: + # Oldest supported versions. - otp: "25.3" elixir: "1.15.4" - coverage: false - server_versions: - cassandra: "4.1" - scylla: "5.2" + # Latest supported versions. + - otp: "27.0" + elixir: "1.17.1" + server_versions: + - cassandra: "3" + scylla: "4.6.3" + - cassandra: "4.1" + scylla: "5.2" env: CASSANDRA_VERSION: ${{ matrix.server_versions.cassandra }} @@ -128,32 +117,27 @@ jobs: - name: Install OTP and Elixir uses: erlef/setup-beam@v1 with: - otp-version: ${{ matrix.otp }} - elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.runtime.otp }} + elixir-version: ${{ matrix.runtime.elixir }} - name: Cache dependencies id: cache-deps - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | deps _build key: | - ${{ runner.os }}-mix-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + ${{ runner.os }}-mix-otp${{ matrix.runtime.otp }}-elixir${{ matrix.runtime.elixir }}-${{ hashFiles('**/mix.lock') }} restore-keys: - ${{ runner.os }}-mix-otp${{ matrix.otp }}-elixir${{ matrix.elixir }}- + ${{ runner.os }}-mix-otp${{ matrix.runtime.otp }}-elixir${{ matrix.runtime.elixir }}- - name: Install and compile dependencies if: steps.cache-deps.outputs.cache-hit != 'true' - run: mix do deps.get --only test + deps.compile + run: mix deps.get --only test # TODO: eventually figure out why we can't run encryption tests on CI. - - name: Run tests for Cassandra and Scylla (with coverage) - if: ${{ matrix.coverage }} - run: mix test.ci_with_coverage --exclude encryption --exclude toxiproxy - - name: Run tests for Cassandra and Scylla (without coverage) - if: ${{ !matrix.coverage }} run: mix test.all --exclude encryption --exclude toxiproxy - name: Dump Docker logs on failure diff --git a/docker-compose.yml b/docker-compose.yml index e8163d63..1a05be06 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3' - services: cassandra: build: diff --git a/lib/xandra/protocol/v3.ex b/lib/xandra/protocol/v3.ex index 7dc6812c..68deba6d 100644 --- a/lib/xandra/protocol/v3.ex +++ b/lib/xandra/protocol/v3.ex @@ -249,7 +249,7 @@ defmodule Xandra.Protocol.V3 do <> end - defp encode_value(:date, value) when value in -@unix_epoch_days..(@unix_epoch_days - 1) do + defp encode_value(:date, value) when value in -@unix_epoch_days..(@unix_epoch_days - 1)//1 do <> end diff --git a/lib/xandra/protocol/v4.ex b/lib/xandra/protocol/v4.ex index e4025a4e..1ef491fa 100644 --- a/lib/xandra/protocol/v4.ex +++ b/lib/xandra/protocol/v4.ex @@ -282,7 +282,7 @@ defmodule Xandra.Protocol.V4 do <> end - defp encode_value(:date, value) when value in -@unix_epoch_days..(@unix_epoch_days - 1) do + defp encode_value(:date, value) when value in -@unix_epoch_days..(@unix_epoch_days - 1)//1 do <> end diff --git a/lib/xandra/protocol/v5.ex b/lib/xandra/protocol/v5.ex index f3d5d4f0..4a3362e0 100644 --- a/lib/xandra/protocol/v5.ex +++ b/lib/xandra/protocol/v5.ex @@ -286,7 +286,7 @@ defmodule Xandra.Protocol.V5 do <> end - defp encode_value(:date, value) when value in -@unix_epoch_days..(@unix_epoch_days - 1) do + defp encode_value(:date, value) when value in -@unix_epoch_days..(@unix_epoch_days - 1)//1 do <> end diff --git a/mix.exs b/mix.exs index a1db57db..7531525b 100644 --- a/mix.exs +++ b/mix.exs @@ -160,7 +160,7 @@ defmodule Xandra.Mixfile do {:ex_doc, "~> 0.30", only: :dev}, {:excoveralls, "~> 0.18", only: :test}, {:mox, "~> 1.0", only: :test}, - {:stream_data, "~> 0.6.0", only: [:dev, :test]}, + {:stream_data, "~> 1.0", only: [:dev, :test]}, {:nimble_lz4, "~> 0.1.3", only: [:dev, :test]}, {:toxiproxy_ex, github: "whatyouhide/toxiproxy_ex", only: :test} ] diff --git a/mix.lock b/mix.lock index 375009d2..e1b99135 100644 --- a/mix.lock +++ b/mix.lock @@ -1,27 +1,27 @@ %{ - "castore": {:hex, :castore, "1.0.4", "ff4d0fb2e6411c0479b1d965a814ea6d00e51eb2f58697446e9c41a97d940b28", [:mix], [], "hexpm", "9418c1b8144e11656f0be99943db4caf04612e3eaecefb5dae9a2a87565584f8"}, + "castore": {:hex, :castore, "1.0.7", "b651241514e5f6956028147fe6637f7ac13802537e895a724f90bf3e36ddd1dd", [:mix], [], "hexpm", "da7785a4b0d2a021cd1292a60875a784b6caef71e76bf4917bdee1f390455cf5"}, "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, - "dialyxir": {:hex, :dialyxir, "1.4.1", "a22ed1e7bd3a3e3f197b68d806ef66acb61ee8f57b3ac85fc5d57354c5482a93", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "84b795d6d7796297cca5a3118444b80c7d94f7ce247d49886e7c291e1ae49801"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"}, + "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"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_doc": {:hex, :ex_doc, "0.30.9", "d691453495c47434c0f2052b08dd91cc32bc4e1a218f86884563448ee2502dd2", [: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", "d7aaaf21e95dc5cddabf89063327e96867d00013963eadf2c6ad135506a8bc10"}, - "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"}, - "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, + "ex_doc": {:hex, :ex_doc, "0.34.0", "ab95e0775db3df71d30cf8d78728dd9261c355c81382bcd4cefdc74610bef13e", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "60734fb4c1353f270c3286df4a0d51e65a2c1d9fba66af3940847cc65a8066d7"}, + "excoveralls": {:hex, :excoveralls, "0.18.1", "a6f547570c6b24ec13f122a5634833a063aec49218f6fff27de9df693a15588c", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "d65f79db146bb20399f23046015974de0079668b9abb2f5aac074d078da60b8d"}, + "hpax": {:hex, :hpax, "0.2.0", "5a58219adcb75977b2edce5eb22051de9362f08236220c9e859a47111c194ff5", [:mix], [], "hexpm", "bea06558cdae85bed075e6c036993d43cd54d447f76d8190a8db0dc5893fa2f1"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, - "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_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"}, + "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [: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", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"}, "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, - "mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"}, - "mox": {:hex, :mox, "1.0.2", "dc2057289ac478b35760ba74165b4b3f402f68803dd5aecd3bfd19c183815d64", [:mix], [], "hexpm", "f9864921b3aaf763c8741b5b8e6f908f44566f1e427b2630e89e9a73b981fef2"}, + "mint": {:hex, :mint, "1.6.1", "065e8a5bc9bbd46a41099dfea3e0656436c5cbcb6e741c80bd2bad5cd872446f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4fc518dcc191d02f433393a72a7ba3f6f94b101d094cb6bf532ea54c89423780"}, + "mox": {:hex, :mox, "1.1.0", "0f5e399649ce9ab7602f72e718305c0f9cdc351190f72844599545e4996af73c", [:mix], [], "hexpm", "d44474c50be02d5b72131070281a5d3895c0e7a95c780e90bc0cfe712f633a13"}, "nimble_lz4": {:hex, :nimble_lz4, "0.1.4", "22b9fa4163e8057a10e6a2238285c1ed8137ea2e2659b8166d7354c0f2957312", [:mix], [{:rustler, "~> 0.29.0", [hex: :rustler, repo: "hexpm", optional: false]}, {:rustler_precompiled, "~> 0.6.2", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "1ae42465181aca22924972682fa52e10e46ecc6541d9df59af6ff3ada00fc592"}, - "nimble_options": {:hex, :nimble_options, "1.0.2", "92098a74df0072ff37d0c12ace58574d26880e522c22801437151a159392270e", [:mix], [], "hexpm", "fd12a8db2021036ce12a309f26f564ec367373265b53e25403f0ee697380f1b8"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, + "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "rustler": {:hex, :rustler, "0.29.1", "880f20ae3027bd7945def6cea767f5257bc926f33ff50c0d5d5a5315883c084d", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "109497d701861bfcd26eb8f5801fe327a8eef304f56a5b63ef61151ff44ac9b6"}, "rustler_precompiled": {:hex, :rustler_precompiled, "0.6.3", "f838d94bc35e1844973ee7266127b156fdc962e9e8b7ff666c8fb4fed7964d23", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "e18ecca3669a7454b3a2be75ae6c3ef01d550bc9a8cf5fbddcfff843b881d7c6"}, - "stream_data": {:hex, :stream_data, "0.6.0", "e87a9a79d7ec23d10ff83eb025141ef4915eeb09d4491f79e52f2562b73e5f47", [:mix], [], "hexpm", "b92b5031b650ca480ced047578f1d57ea6dd563f5b57464ad274718c9c29501c"}, + "stream_data": {:hex, :stream_data, "1.1.1", "fd515ca95619cca83ba08b20f5e814aaf1e5ebff114659dc9731f966c9226246", [:mix], [], "hexpm", "45d0cd46bd06738463fd53f22b70042dbb58c384bb99ef4e7576e7bb7d3b8c8c"}, "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, "tesla": {:hex, :tesla, "1.7.0", "a62dda2f80d4f8a925eb7b8c5b78c461e0eb996672719fe1a63b26321a5f8b4e", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, "~> 1.3", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "2e64f01ebfdb026209b47bc651a0e65203fcff4ae79c11efb73c4852b00dc313"}, "toml": {:hex, :toml, "0.7.0", "fbcd773caa937d0c7a02c301a1feea25612720ac3fa1ccb8bfd9d30d822911de", [:mix], [], "hexpm", "0690246a2478c1defd100b0c9b89b4ea280a22be9a7b313a8a058a2408a2fa70"}, - "toxiproxy_ex": {:git, "https://github.com/whatyouhide/toxiproxy_ex.git", "f77d7371bd0d58c3c6206589fba8c419e331113e", []}, + "toxiproxy_ex": {:git, "https://github.com/whatyouhide/toxiproxy_ex.git", "b4036aabdd63793cf74cedf175de1594029e2f56", []}, } diff --git a/test/xandra_test.exs b/test/xandra_test.exs index 7d9a788c..168f2eee 100644 --- a/test/xandra_test.exs +++ b/test/xandra_test.exs @@ -196,10 +196,14 @@ defmodule XandraTest do describe "execute/3,4" do test "supports the :timeout option", %{conn: conn} do - assert {:error, %ConnectionError{} = error} = - Xandra.execute(conn, "SELECT * FROM system.local", [], timeout: 0) - - assert error.reason == :timeout + # Do this a few times to make it more reliable and make the timeout pop up. + for _ <- 1..5 do + case Xandra.execute(conn, "SELECT * FROM system.local", [], timeout: 0) do + {:error, %ConnectionError{} = error} -> assert error.reason == :timeout + {:ok, _} -> :yeah_alright_its_flaky + other -> flunk("Unexpected return error: #{inspect(other)}") + end + end end # It's an annoyance to set up support for UDFs in Scylla in CI.