diff --git a/core/healthcheck/counter_test.go b/core/healthcheck/counter_test.go index 06f51d5..982bb96 100644 --- a/core/healthcheck/counter_test.go +++ b/core/healthcheck/counter_test.go @@ -13,6 +13,7 @@ type AtomicCounterTest struct { } func TestAtomicCounter(t *testing.T) { + t.Parallel() suite.Run(t, new(AtomicCounterTest)) } diff --git a/core/healthcheck/iface.go b/core/healthcheck/iface.go index 9c53ddf..d5cd195 100644 --- a/core/healthcheck/iface.go +++ b/core/healthcheck/iface.go @@ -21,8 +21,9 @@ type Storage interface { Process(processor Processor) } -// Counter will count successful and failed requests. Its contents can be used to judge if specific entity (e.g. Connection / Account) -// is not working properly (invalid credentials, too many failed requests, etc) and take further action based on the result. +// Counter will count successful and failed requests. Its contents can be used +// to judge if specific entity (e.g. Connection / Account) is not working properly +// (invalid credentials, too many failed requests, etc) and take further action based on the result. // Implementation should be goroutine-safe. type Counter interface { // Name can be used as a more friendly identifier for the counter. @@ -77,7 +78,8 @@ type NotifyMessageLocalizer interface { // It will send the notification to system admins. type NotifyFunc func(apiURL, apiKey, msg string) error -// CounterConstructor is used to create counters. This way you can implement your own counter and still use default CounterStorage. +// CounterConstructor is used to create counters. +// This way you can implement your own counter and still use default CounterStorage. type CounterConstructor func(name string) Counter // ConnectionDataProvider should return the connection credentials and language by counter ID. diff --git a/core/healthcheck/notifier_test.go b/core/healthcheck/notifier_test.go index bb3aee1..8da1562 100644 --- a/core/healthcheck/notifier_test.go +++ b/core/healthcheck/notifier_test.go @@ -14,6 +14,7 @@ import ( ) func TestDefaultNotifyFunc(t *testing.T) { + t.Parallel() apiURL := "https://test.retailcrm.pro" apiKey := "key" msg := "Notification" @@ -37,6 +38,7 @@ func TestDefaultNotifyFunc(t *testing.T) { } func TestDefaultNotifyFunc_Error(t *testing.T) { + t.Parallel() apiURL := "https://test.retailcrm.pro" apiKey := "key" msg := "Notification" diff --git a/core/healthcheck/processor.go b/core/healthcheck/processor.go index 4e213cc..fc11ccd 100644 --- a/core/healthcheck/processor.go +++ b/core/healthcheck/processor.go @@ -5,8 +5,8 @@ import ( ) const ( - // DefaultMinRequests is a default minimal threshold of total requests. If Counter has less than this amount of requests - // total, it will be skipped because it can trigger false alerts otherwise. + // DefaultMinRequests is a default minimal threshold of total requests. If Counter has less than + // this amount of requests total, it will be skipped because it can trigger false alerts otherwise. DefaultMinRequests = 10 // DefaultFailureThreshold is a default value of successful requests that should be passed in order to suppress any @@ -26,7 +26,7 @@ type CounterProcessor struct { Debug bool } -func (c CounterProcessor) Process(id int, counter Counter) bool { +func (c CounterProcessor) Process(id int, counter Counter) bool { // nolint:varnamelen if counter.IsFailed() { if counter.IsFailureProcessed() { c.debugLog("skipping counter id=%d because its failure is already processed", id) diff --git a/core/healthcheck/processor_test.go b/core/healthcheck/processor_test.go index c6d30a9..9774310 100644 --- a/core/healthcheck/processor_test.go +++ b/core/healthcheck/processor_test.go @@ -19,6 +19,7 @@ type CounterProcessorTest struct { } func TestCounterProcessor(t *testing.T) { + t.Parallel() suite.Run(t, new(CounterProcessorTest)) } @@ -349,10 +350,10 @@ func (cm *counterMock) FlushCounters() { } type notifierMock struct { + err error apiURL string apiKey string message string - err error } func (n *notifierMock) Notify(apiURL, apiKey, msg string) error {