From 5413d18666cbb70bba2cc8bd322951a0b5a57fc8 Mon Sep 17 00:00:00 2001 From: Michael Snowden Date: Thu, 19 Jan 2023 13:24:05 -0800 Subject: [PATCH] Add mock archival queue processors to history engine tests (#3817) Add mock archival queue processors to several integration tests missing them --- service/history/historyEngine2_test.go | 5 +++++ service/history/historyEngine_test.go | 5 +++++ service/history/timerQueueActiveTaskExecutor_test.go | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/service/history/historyEngine2_test.go b/service/history/historyEngine2_test.go index 45563485301..d595edb86b4 100644 --- a/service/history/historyEngine2_test.go +++ b/service/history/historyEngine2_test.go @@ -87,6 +87,7 @@ type ( mockTxProcessor *queues.MockQueue mockTimerProcessor *queues.MockQueue mockVisibilityProcessor *queues.MockQueue + mockArchivalProcessor *queues.MockQueue mockEventsCache *events.MockCache mockNamespaceCache *namespace.MockRegistry mockClusterMetadata *cluster.MockMetadata @@ -121,12 +122,15 @@ func (s *engine2Suite) SetupTest() { s.mockTxProcessor = queues.NewMockQueue(s.controller) s.mockTimerProcessor = queues.NewMockQueue(s.controller) s.mockVisibilityProcessor = queues.NewMockQueue(s.controller) + s.mockArchivalProcessor = queues.NewMockQueue(s.controller) s.mockTxProcessor.EXPECT().Category().Return(tasks.CategoryTransfer).AnyTimes() s.mockTimerProcessor.EXPECT().Category().Return(tasks.CategoryTimer).AnyTimes() s.mockVisibilityProcessor.EXPECT().Category().Return(tasks.CategoryVisibility).AnyTimes() + s.mockArchivalProcessor.EXPECT().Category().Return(tasks.CategoryArchival).AnyTimes() s.mockTxProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockTimerProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockVisibilityProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() + s.mockArchivalProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.config = tests.NewDynamicConfig() mockShard := shard.NewTestContext( @@ -177,6 +181,7 @@ func (s *engine2Suite) SetupTest() { timeSource: s.mockShard.GetTimeSource(), eventNotifier: events.NewNotifier(clock.NewRealTimeSource(), metrics.NoopMetricsHandler, func(namespace.ID, string) int32 { return 1 }), queueProcessors: map[tasks.Category]queues.Queue{ + s.mockArchivalProcessor.Category(): s.mockArchivalProcessor, s.mockTxProcessor.Category(): s.mockTxProcessor, s.mockTimerProcessor.Category(): s.mockTimerProcessor, s.mockVisibilityProcessor.Category(): s.mockVisibilityProcessor, diff --git a/service/history/historyEngine_test.go b/service/history/historyEngine_test.go index b91c905e1fe..795d1f1eb4e 100644 --- a/service/history/historyEngine_test.go +++ b/service/history/historyEngine_test.go @@ -91,6 +91,7 @@ type ( mockTxProcessor *queues.MockQueue mockTimerProcessor *queues.MockQueue mockVisibilityProcessor *queues.MockQueue + mockArchivalProcessor *queues.MockQueue mockNamespaceCache *namespace.MockRegistry mockMatchingClient *matchingservicemock.MockMatchingServiceClient mockHistoryClient *historyservicemock.MockHistoryServiceClient @@ -129,12 +130,15 @@ func (s *engineSuite) SetupTest() { s.mockTxProcessor = queues.NewMockQueue(s.controller) s.mockTimerProcessor = queues.NewMockQueue(s.controller) s.mockVisibilityProcessor = queues.NewMockQueue(s.controller) + s.mockArchivalProcessor = queues.NewMockQueue(s.controller) s.mockTxProcessor.EXPECT().Category().Return(tasks.CategoryTransfer).AnyTimes() s.mockTimerProcessor.EXPECT().Category().Return(tasks.CategoryTimer).AnyTimes() s.mockVisibilityProcessor.EXPECT().Category().Return(tasks.CategoryVisibility).AnyTimes() + s.mockArchivalProcessor.EXPECT().Category().Return(tasks.CategoryArchival).AnyTimes() s.mockTxProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockTimerProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockVisibilityProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() + s.mockArchivalProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.config = tests.NewDynamicConfig() s.mockShard = shard.NewTestContext( s.controller, @@ -197,6 +201,7 @@ func (s *engineSuite) SetupTest() { s.mockTxProcessor.Category(): s.mockTxProcessor, s.mockTimerProcessor.Category(): s.mockTimerProcessor, s.mockVisibilityProcessor.Category(): s.mockVisibilityProcessor, + s.mockArchivalProcessor.Category(): s.mockArchivalProcessor, }, eventsReapplier: s.mockEventsReapplier, workflowResetter: s.mockWorkflowResetter, diff --git a/service/history/timerQueueActiveTaskExecutor_test.go b/service/history/timerQueueActiveTaskExecutor_test.go index 244c076344f..05fc0808dbf 100644 --- a/service/history/timerQueueActiveTaskExecutor_test.go +++ b/service/history/timerQueueActiveTaskExecutor_test.go @@ -75,6 +75,7 @@ type ( mockTxProcessor *queues.MockQueue mockTimerProcessor *queues.MockQueue mockVisibilityProcessor *queues.MockQueue + mockArchivalProcessor *queues.MockQueue mockNamespaceCache *namespace.MockRegistry mockMatchingClient *matchingservicemock.MockMatchingServiceClient mockClusterMetadata *cluster.MockMetadata @@ -115,12 +116,15 @@ func (s *timerQueueActiveTaskExecutorSuite) SetupTest() { s.mockTxProcessor = queues.NewMockQueue(s.controller) s.mockTimerProcessor = queues.NewMockQueue(s.controller) s.mockVisibilityProcessor = queues.NewMockQueue(s.controller) + s.mockArchivalProcessor = queues.NewMockQueue(s.controller) s.mockTxProcessor.EXPECT().Category().Return(tasks.CategoryTransfer).AnyTimes() s.mockTimerProcessor.EXPECT().Category().Return(tasks.CategoryTimer).AnyTimes() s.mockVisibilityProcessor.EXPECT().Category().Return(tasks.CategoryVisibility).AnyTimes() + s.mockArchivalProcessor.EXPECT().Category().Return(tasks.CategoryArchival).AnyTimes() s.mockTxProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockTimerProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockVisibilityProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() + s.mockArchivalProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() config := tests.NewDynamicConfig() s.mockShard = shard.NewTestContextWithTimeSource( @@ -174,6 +178,7 @@ func (s *timerQueueActiveTaskExecutorSuite) SetupTest() { s.mockTxProcessor.Category(): s.mockTxProcessor, s.mockTimerProcessor.Category(): s.mockTimerProcessor, s.mockVisibilityProcessor.Category(): s.mockVisibilityProcessor, + s.mockArchivalProcessor.Category(): s.mockArchivalProcessor, }, } s.mockShard.SetEngineForTesting(h)