possibility to run rollback in test env
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Tue, 22 Dec 2020 14:55:30 +0000 (17:55 +0300)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Tue, 22 Dec 2020 14:55:30 +0000 (17:55 +0300)
lib/mix/tasks/pleroma/ecto/rollback.ex
test/mix/tasks/pleroma/ecto/rollback_test.exs

index 3dba952cb57d25f4015ec1f92af0f5390a477b87..41bd04a2842d68636587e76497a9f58a6376b1db 100644 (file)
@@ -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, _, _} =
index 0236e35d529afe9e6a734ae814a871796d333727..56059d89913c2fd70d85d2509a6fa8e05f9ba8dd 100644 (file)
@@ -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)