I’m have been trying to solve this issue for more than a week but unsuccessfull, I need to run my tests in an umbrella application using Triplex database style. But every time I run a test that tries to create some other register in the triplex database, I have this issue.
I am using shared connections and async tests, here’s one of the tests modules failing and my conn_case.ex file that’s sahring the connection:
conn_case.ex
use Mix.Config
# Configure your database
config :loss_prevention, LossPrevention.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "loss_prevention_test",
hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 5,
queue_target: 1000
config :bcrypt_elixir, :log_rounds, 4
# Queue
config :exq,
name: Exq,
host: Map.get(System.get_env(), "REDIS_HOST", "redis"),
port: Map.get(System.get_env(), "REDIS_PORT", "6379"),
password: Map.get(System.get_env(), "REDIS_PASSWORD", "Lossprevention"),
concurrency: 10,
queues: [
"email_test",
"strategy_execution_test",
"schedule_strategy_execution_test",
"alert_bulk",
"export_alerts",
"alert",
"notification",
"api_audit_log",
"monetary_conversion"
],
scheduler_enable: true,
max_retries: 0
config :loss_prevention, LossPrevention.Mailer, adapter: Bamboo.TestAdapter
term_list_controller_test.exs:
defmodule LossPreventionWeb.TermListControllerTest do
use LossPreventionWeb.ConnCase
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
import LossPreventionWeb.Gettext
alias LossPrevention.Wrappers.Elastic.TermList
alias LossPrevention.Wrappers.Elastic
@moduletag company: :test
setup_all do
HTTPoison.start()
end
describe "index" do
test "open term list index page without passing type", %{conn: conn} do
conn =
conn
|> simulate_session()
|> get(term_list_path(conn, :index, status: "active"))
assert html_response(conn, 200) =~ gettext("Group of inclusion terms")
end
end
end
Thanks!