 
   # Ensures that the coordinator is running and puts the pid in the environment
   setup do
-    Application.ensure_started(:baumeister)
-    m = wait_for_coordinator
-    {:ok, coordinator: m}
+    Application.ensure_started(:baumeister_core)
+    {:ok, pid} = Coordinator.start_link(name: Coordinator.name())
+    {:ok,  _ec_pid} = EventCenter.start_link()
+    {:ok, listener} = EventLogger.start_link([subscribe_to: Baumeister.EventCenter.name(),
+      verbose: false])
+    :global.sync()
+    Logger.warn("Coordinator is #{inspect Coordinator.name()}")
+    Logger.warn("Global registered names are: #{inspect :global.registered_names()}")
+
+    m = wait_for_coordinator()
+    assert [] == Coordinator.all_workers()
+    assert 0 == EventCenter.clear()
+    {:ok, coordinator: pid}
   end
 
   def wait_for_coordinator(wait\\ 5)
   def wait_for_coordinator(0), do: flunk "Coordinator is not available :-("
   def wait_for_coordinator(wait) do
-    m = GenServer.whereis(Coordinator.name)
+    m = GenServer.whereis(Coordinator.name())
     if not is_pid(m) do
       # only 1 ms, to let the scheduler recover. This is to
       # prevent a concurrency issue on Travis-CI

    NoopPlugin.make_coordinate(tmp_dir)
  end

  @tag timeout: 1_000
  test "Start a worker", _env do
    {:ok, worker} = Worker.start_link()
    Logger.debug "Worker is started"
    assert is_pid(worker)
    assert Process.alive?(worker)
    all_workers = Coordinator.all_workers()
    Logger.debug "all workers: #{inspect all_workers}"
    assert Enum.any?(all_workers, fn(w) -> w.pid == worker end)
    Process.exit(worker, :normal)
    remaining_workers = Coordinator.all_workers()
    assert not Enum.member?(remaining_workers, worker)
  end

    Process.flag(:trap_exit, true)
    {:ok, worker} = Worker.start_link()
    assert Process.alive?(worker)
    wait_for_worker()

    ref = Process.monitor(GenServer.whereis(Coordinator.name))
    ref_worker = Process.monitor(worker)

