-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,12 @@ Application.put_env(:ecto, :primary_key_type, :id) | |
Application.put_env(:ecto, :async_integration_tests, false) | ||
Application.put_env(:ecto_sql, :lock_for_update, "FOR UPDATE") | ||
|
||
Code.require_file "../support/repo.exs", __DIR__ | ||
Code.require_file("../support/repo.exs", __DIR__) | ||
|
||
# Configure MySQL connection | ||
Application.put_env(:ecto_sql, :mysql_test_url, | ||
Application.put_env( | ||
:ecto_sql, | ||
:mysql_test_url, | ||
"ecto://" <> (System.get_env("MYSQL_URL") || "[email protected]") | ||
) | ||
|
||
|
@@ -53,7 +55,8 @@ alias Ecto.Integration.PoolRepo | |
Application.put_env(:ecto_sql, PoolRepo, | ||
adapter: Ecto.Adapters.MyXQL, | ||
url: Application.get_env(:ecto_sql, :mysql_test_url) <> "/ecto_test", | ||
pool_size: 10, | ||
pool_size: 5, | ||
pool_count: String.to_integer(System.get_env("POOL_COUNT", "1")), | ||
show_sensitive_data_on_connection_error: true | ||
) | ||
|
||
|
@@ -63,8 +66,8 @@ end | |
|
||
# Load support files | ||
ecto = Mix.Project.deps_paths()[:ecto] | ||
Code.require_file "#{ecto}/integration_test/support/schemas.exs", __DIR__ | ||
Code.require_file "../support/migration.exs", __DIR__ | ||
Code.require_file("#{ecto}/integration_test/support/schemas.exs", __DIR__) | ||
Code.require_file("../support/migration.exs", __DIR__) | ||
|
||
defmodule Ecto.Integration.Case do | ||
use ExUnit.CaseTemplate | ||
|
@@ -77,7 +80,7 @@ end | |
{:ok, _} = Ecto.Adapters.MyXQL.ensure_all_started(TestRepo.config(), :temporary) | ||
|
||
# Load up the repository, start it, and run migrations | ||
_ = Ecto.Adapters.MyXQL.storage_down(TestRepo.config()) | ||
_ = Ecto.Adapters.MyXQL.storage_down(TestRepo.config()) | ||
:ok = Ecto.Adapters.MyXQL.storage_up(TestRepo.config()) | ||
|
||
{:ok, _pid} = TestRepo.start_link() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,13 @@ Application.put_env(:ecto, :async_integration_tests, true) | |
Application.put_env(:ecto_sql, :lock_for_update, "FOR UPDATE") | ||
|
||
# Configure PG connection | ||
Application.put_env(:ecto_sql, :pg_test_url, | ||
Application.put_env( | ||
:ecto_sql, | ||
:pg_test_url, | ||
"ecto://" <> (System.get_env("PG_URL") || "postgres:[email protected]") | ||
) | ||
|
||
Code.require_file "../support/repo.exs", __DIR__ | ||
Code.require_file("../support/repo.exs", __DIR__) | ||
|
||
# Define type module | ||
opts = if Code.ensure_loaded?(Duration), do: [interval_decode_type: Duration], else: [] | ||
|
@@ -59,21 +61,28 @@ end | |
|
||
pool_repo_config = [ | ||
url: Application.get_env(:ecto_sql, :pg_test_url) <> "/ecto_test", | ||
pool_size: 10, | ||
pool_size: 5, | ||
pool_count: String.to_integer(System.get_env("POOL_COUNT", "1")), | ||
max_restarts: 20, | ||
max_seconds: 10 | ||
] | ||
|
||
Application.put_env(:ecto_sql, PoolRepo, pool_repo_config) | ||
Application.put_env(:ecto_sql, AdvisoryLockPoolRepo, pool_repo_config ++ [ | ||
migration_source: "advisory_lock_schema_migrations", | ||
migration_lock: :pg_advisory_lock | ||
]) | ||
|
||
Application.put_env( | ||
:ecto_sql, | ||
AdvisoryLockPoolRepo, | ||
pool_repo_config ++ | ||
[ | ||
migration_source: "advisory_lock_schema_migrations", | ||
migration_lock: :pg_advisory_lock | ||
] | ||
) | ||
|
||
# Load support files | ||
ecto = Mix.Project.deps_paths()[:ecto] | ||
Code.require_file "#{ecto}/integration_test/support/schemas.exs", __DIR__ | ||
Code.require_file "../support/migration.exs", __DIR__ | ||
Code.require_file("#{ecto}/integration_test/support/schemas.exs", __DIR__) | ||
Code.require_file("../support/migration.exs", __DIR__) | ||
|
||
defmodule Ecto.Integration.Case do | ||
use ExUnit.CaseTemplate | ||
|
@@ -86,7 +95,7 @@ end | |
{:ok, _} = Ecto.Adapters.Postgres.ensure_all_started(TestRepo.config(), :temporary) | ||
|
||
# Load up the repository, start it, and run migrations | ||
_ = Ecto.Adapters.Postgres.storage_down(TestRepo.config()) | ||
_ = Ecto.Adapters.Postgres.storage_down(TestRepo.config()) | ||
:ok = Ecto.Adapters.Postgres.storage_up(TestRepo.config()) | ||
|
||
{:ok, _pid} = TestRepo.start_link() | ||
|
@@ -112,7 +121,9 @@ exclude_list = excludes ++ excludes_above_9_5 | |
|
||
cond do | ||
Version.match?(version, "< 9.6.0") -> | ||
ExUnit.configure(exclude: exclude_list ++ excludes_below_9_6 ++ excludes_below_12_0 ++ excludes_below_15_0) | ||
ExUnit.configure( | ||
exclude: exclude_list ++ excludes_below_9_6 ++ excludes_below_12_0 ++ excludes_below_15_0 | ||
) | ||
|
||
Version.match?(version, "< 12.0.0") -> | ||
ExUnit.configure(exclude: exclude_list ++ excludes_below_12_0 ++ excludes_below_15_0) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters