Skip to content

Commit

Permalink
Add unique names to cache supervisors in tests (#3055)
Browse files Browse the repository at this point in the history
This commit fixes a flaky test where a supervisor with that same name
was already started.
  • Loading branch information
vinibrsl committed Jun 19, 2023
1 parent 5012e0c commit 41c88c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/plausible/site/cache_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule Plausible.Site.CacheTest do
{:ok, _} =
Supervisor.start_link([{Cache, [cache_name: test, child_id: :test_cache_caches_id]}],
strategy: :one_for_one,
name: Test.Supervisor.Cache
name: :"cache_supervisor_#{test}"
)

%{id: first_id} = site1 = insert(:site, domain: "site1.example.com")
Expand Down Expand Up @@ -58,7 +58,7 @@ defmodule Plausible.Site.CacheTest do
Supervisor.start_link(
[{Cache, [cache_name: test, child_id: :test_cache_caches_revenue_goals]}],
strategy: :one_for_one,
name: Test.Supervisor.Cache
name: :"cache_supervisor_#{test}"
)

%{id: site_id} = site = insert(:site, domain: "site1.example.com")
Expand Down Expand Up @@ -89,7 +89,7 @@ defmodule Plausible.Site.CacheTest do
Supervisor.start_link(
[{Cache, [cache_name: test, child_id: :test_revenue_goals_event_refresh]}],
strategy: :one_for_one,
name: Test.Supervisor.Cache
name: :"cache_supervisor_#{test}"
)

yesterday = DateTime.utc_now() |> DateTime.add(-1 * 60 * 60 * 24)
Expand Down

0 comments on commit 41c88c4

Please sign in to comment.