Add unique names to cache supervisors in tests (#3055)

This commit fixes a flaky test where a supervisor with that same name
was already started.
This commit is contained in:
Vini Brasil 2023-06-19 11:05:00 +01:00 committed by GitHub
parent 5012e0c0ec
commit 41c88c4fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")
@ -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")
@ -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)