diff --git a/lib/umwelt/client/clone.ex b/lib/umwelt/client/clone.ex index 685af24..e2d6b5e 100644 --- a/lib/umwelt/client/clone.ex +++ b/lib/umwelt/client/clone.ex @@ -62,6 +62,7 @@ defmodule Umwelt.Client.Clone do def handle_info(:maybe_stop, state) do if Client.Agent.completed?() do Logger.debug("All modules processed. Stopping application.") + :timer.sleep(99) Supervisor.stop(Client.Supervisor) end diff --git a/test/mix/tasks/clone_test.exs b/test/mix/tasks/clone_test.exs index fee7873..921dcef 100644 --- a/test/mix/tasks/clone_test.exs +++ b/test/mix/tasks/clone_test.exs @@ -10,7 +10,10 @@ defmodule Mix.Tasks.CloneTest do :ok = Application.ensure_started(:umwelt) - on_exit(fn -> File.rm_rf!("temp") end) + on_exit(fn -> + :timer.sleep(99) + File.rm_rf!("temp") + end) {:ok, bypass: bypass} end @@ -65,7 +68,6 @@ defmodule Mix.Tasks.CloneTest do assert capture_log([], fn -> assert :ok == Clone.run([23, "token"]) end) =~ "Done!" - :timer.sleep(666) assert "defmodule Disco" == File.read!("temp/lib/disco.ex") assert "defmodule DiscoTest" == File.read!("temp/test/disco_test.ex") assert "defmodule Disco.Chaos" == File.read!("temp/lib/disco/chaos.ex") diff --git a/test/umwelt/client/writer_test.exs b/test/umwelt/client/writer_test.exs index 362f23c..087fc23 100644 --- a/test/umwelt/client/writer_test.exs +++ b/test/umwelt/client/writer_test.exs @@ -17,7 +17,10 @@ defmodule Umwelt.Client.WriterTest do Agent.add_modules(%{"Disco.Chaos" => 23}) Agent.update_status("Disco.Chaos", :fetched) - on_exit(fn -> File.rm_rf!("temp") end) + on_exit(fn -> + :timer.sleep(99) + File.rm_rf!("temp") + end) {:ok, module: module} end