social.metadata.moe/lib/mix/tasks/pleroma/test_runner.ex
Mark Felder ed2976b237 Custom mix task to retry failed tests once in CI pipeline
This will be temporary* as we hunt down the cause of the random test failures

* gonna regret this
2024-06-19 19:04:12 -04:00

25 lines
472 B
Elixir

defmodule Mix.Tasks.Pleroma.TestRunner do
@shortdoc "Retries tests once if they fail"
use Mix.Task
def run(args \\ []) do
case System.cmd("mix", ["test"] ++ args, into: IO.stream(:stdio, :line)) do
{_, 0} ->
:ok
_ ->
retry(args)
end
end
def retry(args) do
case System.cmd("mix", ["test", "--failed"] ++ args, into: IO.stream(:stdio, :line)) do
{_, 0} ->
:ok
_ ->
exit(1)
end
end
end