diff options
author | Ronny Berndt <ronny@apache.org> | 2022-12-21 13:19:51 +0100 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2022-12-21 18:43:15 +0100 |
commit | 9aee170be14143cf2dfd28a74674a6511b0f3a48 (patch) | |
tree | 7c493bf94fdea73a8f821043ba8b516738bac3e3 | |
parent | 1c214267c27c7c68d1717ae0fe5602a14d64a2f5 (diff) | |
download | couchdb-9aee170be14143cf2dfd28a74674a6511b0f3a48.tar.gz |
Fix {eaddrnotavail} in elixir tests under Windows
-rw-r--r-- | test/elixir/lib/couch/dbtest.ex | 16 | ||||
-rw-r--r-- | test/elixir/test/security_validation_test.exs | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/test/elixir/lib/couch/dbtest.ex b/test/elixir/lib/couch/dbtest.ex index 652fa6bb6..ae59da09f 100644 --- a/test/elixir/lib/couch/dbtest.ex +++ b/test/elixir/lib/couch/dbtest.ex @@ -305,8 +305,8 @@ defmodule Couch.DBTest do userinfo end - src = set_user(src, userinfo) - tgt = set_user(tgt, userinfo) + src = set_user(get_absolute_url(src), userinfo) + tgt = set_user(get_absolute_url(tgt), userinfo) defaults = [headers: [], body: %{}, timeout: 30_000] options = defaults |> Keyword.merge(options) |> Enum.into(%{}) @@ -320,6 +320,18 @@ defmodule Couch.DBTest do resp.body end + defp get_absolute_url("http://" <> _ = uri) do + uri + end + + defp get_absolute_url("/" <> _ = uri) do + Couch.process_url(uri) + end + + defp get_absolute_url(uri) do + Couch.process_url("/" <> uri) + end + defp set_user(uri, userinfo) do case URI.parse(uri) do %{scheme: nil} -> diff --git a/test/elixir/test/security_validation_test.exs b/test/elixir/test/security_validation_test.exs index adc282a9e..5c8db1b45 100644 --- a/test/elixir/test/security_validation_test.exs +++ b/test/elixir/test/security_validation_test.exs @@ -306,7 +306,7 @@ defmodule SecurityValidationTest do foo2 = Map.put(foo2, "value", "b") assert Couch.put("/#{db_name_b}/foo2", body: foo2, headers: spike).body["ok"] - result = replicate(db_name_b, db_name_a, headers: spike) + result = replicate(db_name_b, db_name_a, [{:userinfo, "spike:dog"}, {:headers, spike}]) assert Enum.at(result["history"], 0)["docs_written"] == 1 assert Enum.at(result["history"], 0)["doc_write_failures"] == 2 |