Browse Source

Add a test for custom runtime modules

chore/benchmark-dedicated-db
Egor Kislitsyn 4 years ago
parent
commit
a75d4a41e0
4 changed files with 27 additions and 3 deletions
  1. +2
    -0
      config/test.exs
  2. +5
    -3
      lib/pleroma/application.ex
  3. +9
    -0
      test/fixtures/modules/runtime_module.ex
  4. +11
    -0
      test/runtime_test.exs

+ 2
- 0
config/test.exs View File

@@ -93,6 +93,8 @@ config :joken, default_signer: "yU8uHKq+yyAkZ11Hx//jcdacWc8yQ1bxAAGrplzB0Zwwjkp3

config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock

config :pleroma, :modules, runtime_dir: "test/fixtures/modules"

if File.exists?("./config/test.secret.exs") do
import_config "test.secret.exs"
else


+ 5
- 3
lib/pleroma/application.ex View File

@@ -81,9 +81,11 @@ defmodule Pleroma.Application do
raise "Invalid custom modules"

{:ok, modules, _warnings} ->
Enum.each(modules, fn mod ->
IO.puts("Custom module loaded: #{inspect(mod)}")
end)
if @env != :test do
Enum.each(modules, fn mod ->
IO.puts("Custom module loaded: #{inspect(mod)}")
end)
end

:ok
end


+ 9
- 0
test/fixtures/modules/runtime_module.ex View File

@@ -0,0 +1,9 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only

defmodule RuntimeModule do
@moduledoc """
This is a dummy module to test custom runtime modules.
"""
end

+ 11
- 0
test/runtime_test.exs View File

@@ -0,0 +1,11 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only

defmodule Pleroma.RuntimeTest do
use ExUnit.Case, async: true

test "it loads custom runtime modules" do
assert Code.ensure_compiled?(RuntimeModule)
end
end

Loading…
Cancel
Save