diff --git a/lib/xandra.ex b/lib/xandra.ex index a4f0087e..46c41199 100644 --- a/lib/xandra.ex +++ b/lib/xandra.ex @@ -275,6 +275,7 @@ defmodule Xandra do {module(), function_name :: atom(), [term()]} | (keyword() -> keyword()) @valid_consistencies [ + :any, :one, :two, :three, diff --git a/test/integration/any_consistency_test.exs b/test/integration/any_consistency_test.exs new file mode 100644 index 00000000..9deab7c2 --- /dev/null +++ b/test/integration/any_consistency_test.exs @@ -0,0 +1,22 @@ +defmodule AnyConsistencyTest do + use XandraTest.IntegrationCase, async: true + + # Regression for: https://github.com/lexhide/xandra/issues/381 + test "queries with :any consistency are correctly executed", %{conn: conn} do + statement = "CREATE TABLE cyclists (first_name text, last_name text PRIMARY KEY)" + Xandra.execute!(conn, statement, %{}, consistency: :any) + + statement = "INSERT INTO cyclists (first_name, last_name) VALUES (:first_name, :last_name)" + + {:ok, %Xandra.Void{}} = + Xandra.execute( + conn, + statement, + %{ + "first_name" => {"text", "KRUIKSWIJK"}, + "last_name" => {"text", "Steven"} + }, + consistency: :any + ) + end +end