mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-22 06:36:16 +00:00
98cb255d12
OTP builds to 1.15
Changelog entry
Ensure policies are fully loaded
Fix :warn
use main branch for linkify
Fix warn in tests
Migrations for phoenix 1.17
Revert "Migrations for phoenix 1.17"
This reverts commit 6a3b2f15b7
.
Oban upgrade
Add default empty whitelist
mix format
limit test to amd64
OTP 26 tests for 1.15
use OTP_VERSION tag
baka
just 1.15
Massive deps update
Update locale, deps
Mix format
shell????
multiline???
?
max cases 1
use assert_recieve
don't put_env in async tests
don't async conn/fs tests
mix format
FIx some uploader issues
Fix tests
71 lines
2.7 KiB
Elixir
71 lines
2.7 KiB
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.JobQueueMonitorTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
alias Pleroma.JobQueueMonitor
|
|
|
|
@success {:process_event, :success, 1337,
|
|
%{
|
|
args: %{"op" => "refresh_subscriptions"},
|
|
attempt: 1,
|
|
id: 339,
|
|
max_attempts: 5,
|
|
queue: "federator_outgoing",
|
|
worker: "Pleroma.Workers.SubscriberWorker"
|
|
}}
|
|
|
|
@failure {:process_event, :failure, 22_521_134,
|
|
%{
|
|
args: %{"op" => "force_password_reset", "user_id" => "9nJG6n6Nbu7tj9GJX6"},
|
|
attempt: 1,
|
|
error: %RuntimeError{message: "oops"},
|
|
id: 345,
|
|
kind: :exception,
|
|
max_attempts: 1,
|
|
queue: "background",
|
|
stack: [
|
|
{Pleroma.Workers.BackgroundWorker, :perform, 2,
|
|
[file: ~c"lib/pleroma/workers/background_worker.ex", line: 31]},
|
|
{Oban.Queue.Executor, :safe_call, 1,
|
|
[file: ~c"lib/oban/queue/executor.ex", line: 42]},
|
|
{:timer, :tc, 3, [file: ~c"timer.erl", line: 197]},
|
|
{Oban.Queue.Executor, :call, 2, [file: ~c"lib/oban/queue/executor.ex", line: 23]},
|
|
{Task.Supervised, :invoke_mfa, 2, [file: ~c"lib/task/supervised.ex", line: 90]},
|
|
{:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 249]}
|
|
],
|
|
worker: "Pleroma.Workers.BackgroundWorker"
|
|
}}
|
|
|
|
test "stats/0" do
|
|
assert %{processed_jobs: _, queues: _, workers: _} = JobQueueMonitor.stats()
|
|
end
|
|
|
|
test "handle_cast/2" do
|
|
state = %{workers: %{}, queues: %{}, processed_jobs: 0}
|
|
|
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@success, state)
|
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@failure, state)
|
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@success, state)
|
|
assert {:noreply, state} = JobQueueMonitor.handle_cast(@failure, state)
|
|
|
|
assert state == %{
|
|
processed_jobs: 4,
|
|
queues: %{
|
|
"background" => %{failure: 2, processed_jobs: 2, success: 0},
|
|
"federator_outgoing" => %{failure: 0, processed_jobs: 2, success: 2}
|
|
},
|
|
workers: %{
|
|
"Pleroma.Workers.BackgroundWorker" => %{
|
|
"force_password_reset" => %{failure: 2, processed_jobs: 2, success: 0}
|
|
},
|
|
"Pleroma.Workers.SubscriberWorker" => %{
|
|
"refresh_subscriptions" => %{failure: 0, processed_jobs: 2, success: 2}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
end
|