Skip to content

Commit

Permalink
Reset index metrics tracker before testing it.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpendragon committed Nov 27, 2024
1 parent be8b41a commit 0c0bc37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/dpul_collections/index_metrics_tracker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ defmodule DpulCollections.IndexMetricsTracker do
Metrics.index_metrics(source.processor_marker_key(), "full_index")
end

def reset() do
GenServer.call(__MODULE__, {:reset})
end

@impl true
def handle_call({:reset}, _, _state) do
{:reply, nil, %{}}
end

@impl true
def handle_call({:fresh_index, source}, _, state) do
new_state =
Expand Down
5 changes: 5 additions & 0 deletions test/dpul_collections/index_metrics_tracker_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ defmodule DpulCollections.IndexMetricsTrackerTest do
use DpulCollections.DataCase

describe "index_times/1" do
setup do
IndexMetricsTracker.reset()
:ok
end

test "registers index times" do
# Act
# Send an ack done with acked_count 1, before anything - this should be
Expand Down

0 comments on commit 0c0bc37

Please sign in to comment.