Skip to content
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
13 changes: 8 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Tests

on:
push:
pull_request:
branches:
- main
push:

env:
ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16
Expand All @@ -15,20 +13,24 @@ jobs:
tests:
name: Run tests (${{ matrix.image }})

# prevent workflow jobs run twice on push and pull_request event
# see https://github.com/orgs/community/discussions/57827
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

strategy:
fail-fast: false
matrix:
include:
- image: 1.6.6-erlang-21.3.8.24-debian-buster-20210902-slim
- image: 1.17.2-erlang-27.0.1-debian-bookworm-20240701-slim
- image: 1.19.3-erlang-28.1.1-debian-bullseye-20251103-slim

runs-on: ubuntu-latest
container:
image: hexpm/elixir:${{ matrix.image }}

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Hex and Rebar setup
run: |
Expand All @@ -44,6 +46,7 @@ jobs:
key: deps-${{ runner.os }}-${{ matrix.image }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ matrix.image }}

- name: Install dependencies
run: mix deps.get --only test

Expand Down
15 changes: 13 additions & 2 deletions test/shared/pubsub_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ defmodule Phoenix.PubSubTest do
@tag registry_size: 2
test "PubSub pool size can be configured separately from the Registry partitions",
config do
assert {:duplicate, 2, _} = :ets.lookup_element(config.pubsub, -2, 2)
assert_ets_duplicate_count(config.pubsub, 2)

assert :persistent_term.get(config.adapter_name) ==
{config.adapter_name, :"#{config.adapter_name}_2", :"#{config.adapter_name}_3", :"#{config.adapter_name}_4"}
Expand All @@ -190,9 +190,20 @@ defmodule Phoenix.PubSubTest do
@tag pool_size: 3
test "Registry partitions are configured with the same pool size as PubSub if not specified",
config do
assert {:duplicate, 3, _} = :ets.lookup_element(config.pubsub, -2, 2)
assert_ets_duplicate_count(config.pubsub, 3)

assert :persistent_term.get(config.adapter_name) ==
{config.adapter_name, :"#{config.adapter_name}_2", :"#{config.adapter_name}_3"}
end

defp assert_ets_duplicate_count(pubsub, count) do
result = :ets.lookup_element(pubsub, -2, 2)

case System.otp_release() do
otp when otp >= "28" ->
assert {{:duplicate, :pid}, ^count, _} = result
_ ->
assert {:duplicate, ^count, _} = result
end
end
end