Skip to content

Commit

Permalink
Possible fix blinking test
Browse files Browse the repository at this point in the history
  • Loading branch information
sovetnik committed Aug 18, 2024
1 parent d23154e commit 4168e65
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/umwelt/client/clone.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions test/mix/tasks/clone_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 4 additions & 1 deletion test/umwelt/client/writer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4168e65

Please sign in to comment.