Skip to content

Commit

Permalink
Allow integration tests to run on PostgreSQL 10.4 (#2696)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDryga authored and José Valim committed Oct 3, 2018
1 parent 66ff014 commit 7ef3c45
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion integration_test/pg/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ _ = Ecto.Adapters.Postgres.storage_down(TestRepo.config)

%{rows: [[version]]} = TestRepo.query!("SHOW server_version", [])

if Version.match?(version, "~> 9.5") do
version =
case Regex.named_captures(~r/(?<major>[0-9]*)(\.(?<minor>[0-9]*))?.*/, version) do
%{"major" => major, "minor" => minor} -> "#{major}.#{minor}.0"
%{"major" => major} -> "#{major}.0.0"
_other -> version
end

if Version.match?(version, ">= 9.5.0") do
ExUnit.configure(exclude: [:without_conflict_target])
else
Application.put_env(:ecto, :postgres_map_type, "json")
Expand Down

0 comments on commit 7ef3c45

Please sign in to comment.