@@ -18,61 +18,11 @@ defmodule Kafkaesque.TestCase do
1818 end
1919
2020 setup do
21- # Start required registries and services
22- ensure_registry_started ( )
23- # Only start PubSub if the application isn't already managing it
24- unless Application . started_applications ( ) |> Enum . any? ( fn { app , _ , _ } -> app == :kafkaesque_core end ) do
25- ensure_pubsub_started ( )
26- end
27- ensure_telemetry_started ( )
28-
21+ # The application is started in test_helper.exs, so we don't need to start services here
22+ # They should already be running
2923 :ok
3024 end
3125
32- @ doc """
33- Ensures the Registry is started.
34- """
35- def ensure_registry_started do
36- case Registry . start_link ( keys: :unique , name: Kafkaesque.TopicRegistry ) do
37- { :ok , _ } -> :ok
38- { :error , { :already_started , _ } } -> :ok
39- end
40- end
41-
42- @ doc """
43- Ensures PubSub is started.
44- """
45- def ensure_pubsub_started do
46- # Check if PubSub is already running
47- case Process . whereis ( Kafkaesque.PubSub ) do
48- nil ->
49- # Not running, start it
50- children = [
51- { Phoenix.PubSub , name: Kafkaesque.PubSub }
52- ]
53-
54- case Supervisor . start_link ( children , strategy: :one_for_one , name: KafkaesqueTestPubSub ) do
55- { :ok , _ } -> :ok
56- { :error , { :already_started , _ } } -> :ok
57- { :error , { :shutdown , { :failed_to_start_child , Phoenix.PubSub , { :already_started , _ } } } } -> :ok
58- end
59-
60- _pid ->
61- # Already running
62- :ok
63- end
64- end
65-
66- @ doc """
67- Ensures Telemetry is started.
68- """
69- def ensure_telemetry_started do
70- case Kafkaesque.Telemetry . start_link ( [ ] ) do
71- { :ok , _ } -> :ok
72- { :error , { :already_started , _ } } -> :ok
73- end
74- end
75-
7626 @ doc """
7727 Sets up a test directory and ensures cleanup on exit.
7828 """
0 commit comments