Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore (sync-service): run filter logic for PG version 15 in unit tests #1672

Merged
merged 4 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rare-cooks-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@core/sync-service": patch
---

Run filter logic for PG version 15 in unit tests.
2 changes: 2 additions & 0 deletions .github/workflows/elixir_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
working-directory: packages/sync-service
env:
MIX_ENV: test
POSTGRES_MAJOR_VERSION: 14
services:
postgres:
image: postgres:14-alpine
Expand Down Expand Up @@ -73,6 +74,7 @@ jobs:
working-directory: packages/sync-service
env:
MIX_ENV: test
POSTGRES_MAJOR_VERSION: 15
services:
postgres:
image: postgres:15-alpine
Expand Down
5 changes: 4 additions & 1 deletion packages/sync-service/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ config :logger, level: :debug
# handle_otp_reports: true,
# handle_sasl_reports: true

if config_env() == :test, do: config(:logger, level: :info)
if config_env() == :test do
config(:logger, level: :info)
config(:electric, major_pg_version_for_tests: env!("POSTGRES_MAJOR_VERSION", :integer, 15))
end

if config_env() in [:dev, :test] do
source!([".env.#{config_env()}", ".env.#{config_env()}.local", System.get_env()])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ defmodule Electric.Shapes.ConsumerTest do
}
]

get_pg_version = fn -> 14 end
get_pg_version = fn -> Application.fetch_env!(:electric, :major_pg_version_for_tests) end

shape_cache_config =
[
Expand Down
3 changes: 1 addition & 2 deletions packages/sync-service/test/support/component_setup.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule Support.ComponentSetup do
shape_meta_table = :"shape_meta_#{full_test_name(ctx)}"
server = :"shape_cache_#{full_test_name(ctx)}"
consumer_supervisor = :"consumer_supervisor_#{full_test_name(ctx)}"
get_pg_version = fn -> 14 end
get_pg_version = fn -> Application.fetch_env!(:electric, :major_pg_version_for_tests) end

start_opts =
[
Expand All @@ -76,7 +76,6 @@ defmodule Support.ComponentSetup do
{
Electric.Postgres.Configuration,
:configure_tables_for_replication!,
# TODO: can pass PG version here, then in Application also pass it there, or pass a function that returns the version
[get_pg_version, ctx.publication_name]
}
end)
Expand Down
Loading