Skip to content

Commit fc6d003

Browse files
joaothallisrai200890
authored andcommitted
fix: tests
1 parent a9d268b commit fc6d003

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

lib/new_relic/reporter.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
defmodule EctoJobScheduler.NewRelic.Reporter do
22
@moduledoc false
33

4-
@callback start() :: term()
4+
@callback start_transaction(:other) :: term()
55

6-
@callback add_attributes(keyword()) :: term()
6+
@callback stop_transaction(:other) :: term()
77

8-
@callback fail(pid(), map()) :: term()
8+
@callback add_attributes(keyword()) :: term()
99

10-
@callback complete(pid(), atom()) :: term()
10+
@callback fail(map()) :: term()
1111
end

test/job_queue_test.exs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule EctoJobScheduler.JobQueueTest do
1515
setup do
1616
if unquote(job_queue) == TestJobQueueNewRelic do
1717
ReporterMock
18-
|> Mox.expect(:start, fn -> :ok end)
18+
|> Mox.expect(:start_transaction, fn _ -> :ok end)
1919
|> Mox.expect(:add_attributes, fn _ -> :ok end)
2020
end
2121

@@ -35,6 +35,9 @@ defmodule EctoJobScheduler.JobQueueTest do
3535

3636
job = Repo.one(unquote(job_queue))
3737

38+
Mox.expect(ReporterMock, :stop_transaction, fn _ -> :ok end)
39+
Mox.expect(ReporterMock, :fail, fn _ -> :ok end)
40+
3841
assert {:ok, %{test_job: :xablau}} =
3942
EctoJobHelpers.dispatch_job(Repo, unquote(job_queue), job)
4043

@@ -58,6 +61,10 @@ defmodule EctoJobScheduler.JobQueueTest do
5861

5962
job = Repo.one(unquote(job_queue))
6063

64+
Mox.expect(ReporterMock, :fail, fn _ -> :ok end)
65+
66+
Mox.expect(ReporterMock, :stop_transaction, fn _ -> :ok end)
67+
6168
assert {:error, :test_job, :xablau, %{}} =
6269
EctoJobHelpers.dispatch_job(Repo, unquote(job_queue), job)
6370

@@ -86,6 +93,9 @@ defmodule EctoJobScheduler.JobQueueTest do
8693

8794
job = Repo.one(unquote(job_queue))
8895

96+
Mox.expect(ReporterMock, :stop_transaction, fn _ -> :ok end)
97+
Mox.expect(ReporterMock, :fail, fn _ -> :ok end)
98+
8999
assert {:ok, :xablau} == EctoJobHelpers.dispatch_job(Repo, unquote(job_queue), job)
90100

91101
assert Repo.all(unquote(job_queue)) == []
@@ -100,9 +110,12 @@ defmodule EctoJobScheduler.JobQueueTest do
100110

101111
test "#{job_queue} when job doesn't return multi and fails, should update job attempt" do
102112
if unquote(job_queue) == TestJobQueueNewRelic do
103-
Mox.expect(ReporterMock, :fail, fn _, _ -> :ok end)
113+
Mox.expect(ReporterMock, :fail, fn _ -> :ok end)
104114
end
105115

116+
Mox.expect(ReporterMock, :stop_transaction, fn _ -> :ok end)
117+
Mox.expect(ReporterMock, :fail, fn _ -> :ok end)
118+
106119
job_args = %{
107120
"type" => "TestJobNotMultiError",
108121
"context" => %{some: :thing}

0 commit comments

Comments
 (0)