diff --git a/lib/dpul_collections/index_metrics_tracker.ex b/lib/dpul_collections/index_metrics_tracker.ex index d30edad0..122d98c8 100644 --- a/lib/dpul_collections/index_metrics_tracker.ex +++ b/lib/dpul_collections/index_metrics_tracker.ex @@ -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 = diff --git a/test/dpul_collections/index_metrics_tracker_test.exs b/test/dpul_collections/index_metrics_tracker_test.exs index e64b9351..08b743f9 100644 --- a/test/dpul_collections/index_metrics_tracker_test.exs +++ b/test/dpul_collections/index_metrics_tracker_test.exs @@ -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