diff --git a/common/nexus/endpoint_registry_test.go b/common/nexus/endpoint_registry_test.go index a9b14d9c7e..f2fa488c81 100644 --- a/common/nexus/endpoint_registry_test.go +++ b/common/nexus/endpoint_registry_test.go @@ -18,12 +18,10 @@ import ( "go.temporal.io/server/common/clock/hybrid_logical_clock" "go.temporal.io/server/common/dynamicconfig" "go.temporal.io/server/common/log" - "go.temporal.io/server/common/log/tag" "go.temporal.io/server/common/metrics" "go.temporal.io/server/common/persistence" "go.temporal.io/server/common/testing/protoassert" "go.temporal.io/server/common/testing/protorequire" - "go.temporal.io/server/common/testing/testlogger" "go.uber.org/mock/gomock" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -184,32 +182,20 @@ func TestInitializationFallback(t *testing.T) { testEndpoint := newEndpointEntry(t.Name()) mocks := newTestMocks(t) - matchingErr := serviceerror.NewUnavailable("matching unavailable test error") - mocks.matchingClient.EXPECT().ListNexusEndpoints(gomock.Any(), gomock.Any()).Return(nil, matchingErr).MinTimes(1) + mocks.matchingClient.EXPECT().ListNexusEndpoints(gomock.Any(), gomock.Any()).Return(nil, serviceerror.NewUnavailable("matching unavailable test error")).MinTimes(1) mocks.persistence.EXPECT().ListNexusEndpoints(gomock.Any(), gomock.Any()).Return(&persistence.ListNexusEndpointsResponse{ TableVersion: int64(1), NextPageToken: nil, Entries: []*persistencespb.NexusEndpointEntry{testEndpoint}, }, nil) - logger := testlogger.NewTestLogger(t, testlogger.FailOnExpectedErrorOnly) - capture := logger.StartCapture() - reg := NewEndpointRegistry(mocks.config, mocks.matchingClient, mocks.persistence, log.With(logger, tag.ComponentPersistence), metrics.NoopMetricsHandler) + reg := NewEndpointRegistry(mocks.config, mocks.matchingClient, mocks.persistence, log.NewNoopLogger(), metrics.NoopMetricsHandler) reg.StartLifecycle() defer reg.StopLifecycle() endpoint, err := reg.GetByID(context.Background(), testEndpoint.Id) require.NoError(t, err) protoassert.ProtoEqual(t, testEndpoint, endpoint) - capture.RequireContains(t, testlogger.CapturedLogPattern{ - Level: testlogger.Error, - Message: "error from matching when initializing Nexus endpoint cache", - Tags: map[string]any{ - "component": "persistence", - "nexus-stage": "registry", - "error": matchingErr.Error(), - }, - }) reg.dataLock.RLock() defer reg.dataLock.RUnlock() diff --git a/service/history/circuitbreakerpool/fx_test.go b/service/history/circuitbreakerpool/fx_test.go index 6ddf6eeab1..65b210560e 100644 --- a/service/history/circuitbreakerpool/fx_test.go +++ b/service/history/circuitbreakerpool/fx_test.go @@ -16,7 +16,7 @@ import ( ) func TestOnStateChangeNexusStage(t *testing.T) { - testCases := []struct { + for _, testCase := range []struct { name string taskGroup string stage string @@ -45,9 +45,7 @@ func TestOnStateChangeNexusStage(t *testing.T) { name: "shared HSM callback", taskGroup: callbacks.TaskTypeInvocation, }, - } - - for _, testCase := range testCases { + } { t.Run(testCase.name, func(t *testing.T) { logger := testlogger.NewTestLogger(t, testlogger.FailOnExpectedErrorOnly) capture := logger.StartCapture()