     GenStage.sync_subscribe(listener, to: Baumeister.EventCenter)
     {:ok, pid} = Observer.start_link(context[:test])
     assert is_pid(pid)
+
+    # Let the listener drain the event queue of old events.
+    wait_for fn -> 0 == EventCenter.clear() end
+    # wait_for fn -> 0 == TestListener.clear(listener) end
 
     # merge this with the context
     [pid: pid, listener: listener]


  alias Baumeister.Test.TestListener
  alias Experimental.GenStage

  alias Baumeister.Observer
  alias Baumeister.Observer.FailPlugin
  alias Baumeister.Observer.NoopPlugin
  alias Baumeister.Observer.Take

  def wait_for(pred) do
    case pred.() do

    """

    Observer.configure(pid, [{NoopPlugin, {"file:///", bmf}},{Take, 2}])
    TestListener.clear(listener)
    :ok = Observer.run(pid)

    wait_for fn -> length(TestListener.get(listener)) >= 3 end
