commit: 2217b35bd40593f5dcfdba4c13dd7b7bded018f3
parent 74bd9980adb5dedf9309334e26cb4d9c57f6c46b
Author: feld <feld@feld.me>
Date: Fri, 26 Feb 2021 16:47:53 +0000
Merge branch 'ecto-rollback-in-test-env' into 'develop'
Possibility to run rollback in test env
See merge request pleroma/pleroma!3212
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/mix/tasks/pleroma/ecto/rollback.ex b/lib/mix/tasks/pleroma/ecto/rollback.ex
@@ -20,7 +20,8 @@ defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
start: :boolean,
quiet: :boolean,
log_sql: :boolean,
- migrations_path: :string
+ migrations_path: :string,
+ env: :string
]
@moduledoc """
@@ -59,7 +60,7 @@ defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
level = Logger.level()
Logger.configure(level: :info)
- if Pleroma.Config.get(:env) == :test do
+ if opts[:env] == "test" do
Logger.info("Rollback succesfully")
else
{:ok, _, _} =
diff --git a/test/mix/tasks/pleroma/ecto/rollback_test.exs b/test/mix/tasks/pleroma/ecto/rollback_test.exs
@@ -12,7 +12,7 @@ defmodule Mix.Tasks.Pleroma.Ecto.RollbackTest do
Logger.configure(level: :warn)
assert capture_log(fn ->
- Mix.Tasks.Pleroma.Ecto.Rollback.run()
+ Mix.Tasks.Pleroma.Ecto.Rollback.run(["--env", "test"])
end) =~ "[info] Rollback succesfully"
Logger.configure(level: level)