diff --git a/test/utils/jsonloganalyzer.go b/test/utils/jsonloganalyzer.go index d24a7222..c6ae8396 100644 --- a/test/utils/jsonloganalyzer.go +++ b/test/utils/jsonloganalyzer.go @@ -28,11 +28,11 @@ func NewJsonLogAnalyzer() *JsonLogAnalyzer { } } -func (r *JsonLogAnalyzer) AddGroup(analyzers ...*JsonLogMatcher) { +func (a *JsonLogAnalyzer) AddGroup(analyzers ...*JsonLogMatcher) { r.Matchers = append(r.Matchers, analyzers) } -func (r *JsonLogAnalyzer) OnStop(fn func()) { +func (a *JsonLogAnalyzer) OnStop(fn func()) { r.OnStopFn = fn } @@ -57,10 +57,10 @@ func (a *JsonLogAnalyzer) Reset() { } func (a *JsonLogAnalyzer) HandleLine(line string) { - //fmt.Printf("Got line: %s\n", line) - //defer func() { + // fmt.Printf("Got line: %s\n", line) + // defer func() { // fmt.Printf("analyzer.HandleLine done: ind=%d fin=%v err=%v\n", a.Index, a.finished, a.err) - //}() + // }() if a.finished { return } @@ -156,14 +156,14 @@ func NewJsonLogMatcher(steps ...*MatcherStep) *JsonLogMatcher { } } -func (m *JsonLogMatcher) HandleRecord(r JsonLogRecord) { +func (m *JsonLogMatcher) HandleRecord(_ JsonLogRecord) { } func (m *JsonLogMatcher) HandleLine(line string) { - //fmt.Printf("Matcher Got line: %s\n", line) - //defer func() { + // fmt.Printf("Matcher Got line: %s\n", line) + // defer func() { // fmt.Printf("matcher.HandleLine done: ind=%d fin=%v err=%v\n", m.Index, m.finished, m.err) - //}() + // }() defer func() { e := recover() if e != nil { @@ -259,7 +259,7 @@ func (matcher *FinishAllMatchersSuccessfullyMatcher) Match(actual interface{}) ( return matcher.finished && matcher.err == nil, nil } -func (matcher *FinishAllMatchersSuccessfullyMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *FinishAllMatchersSuccessfullyMatcher) FailureMessage(_ interface{}) (message string) { msgs := []string{} if !matcher.finished { msgs = append(msgs, "is finished") @@ -270,7 +270,7 @@ func (matcher *FinishAllMatchersSuccessfullyMatcher) FailureMessage(actual inter return fmt.Sprintf("Expected JsonLogAnalyzer %s", strings.Join(msgs, " and ")) } -func (matcher *FinishAllMatchersSuccessfullyMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *FinishAllMatchersSuccessfullyMatcher) NegatedFailureMessage(_ interface{}) (message string) { msgs := []string{} if matcher.finished { msgs = append(msgs, "is not finished") diff --git a/test/utils/prometheus.go b/test/utils/prometheus.go index 926385d1..0294ffbc 100644 --- a/test/utils/prometheus.go +++ b/test/utils/prometheus.go @@ -127,10 +127,10 @@ func (p *PromScraper) Scrape() error { return nil } -func (p *PromScraper) HasMetric(name string) { +func (p *PromScraper) HasMetric(_ string) { } -func (p *PromScraper) MetricEquals(name string) { +func (p *PromScraper) MetricEquals(_ string) { } // FindExact searches metric by name and labels @@ -199,11 +199,11 @@ func (matcher *HaveMetricMatcher) Match(actual interface{}) (success bool, err e return !promScraper.FindExact(matcher.pmv).IsEmpty(), nil } -func (matcher *HaveMetricMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *HaveMetricMatcher) FailureMessage(_ interface{}) (message string) { return "Expected ShellOperator has metric" } -func (matcher *HaveMetricMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *HaveMetricMatcher) NegatedFailureMessage(_ interface{}) (message string) { return "Expected ShellOperator has no metric" } diff --git a/test/utils/shell-operator.go b/test/utils/shell-operator.go index 3b9daa18..cf1690bc 100644 --- a/test/utils/shell-operator.go +++ b/test/utils/shell-operator.go @@ -109,10 +109,10 @@ func (matcher *BeShellOperatorStoppedMatcher) Match(actual interface{}) (success return matcher.err != nil && strings.Contains(matcher.err.Error(), "command is stopped"), nil } -func (matcher *BeShellOperatorStoppedMatcher) FailureMessage(actual interface{}) (message string) { +func (matcher *BeShellOperatorStoppedMatcher) FailureMessage(_ interface{}) (message string) { return fmt.Sprintf("Expected ShellOperator stopped. Got error: %v", matcher.err) } -func (matcher *BeShellOperatorStoppedMatcher) NegatedFailureMessage(actual interface{}) (message string) { +func (matcher *BeShellOperatorStoppedMatcher) NegatedFailureMessage(_ interface{}) (message string) { return "Expected ShellOperator stopped with error" } diff --git a/test/utils/streamedexec.go b/test/utils/streamedexec.go index 856086d4..1dcb7f0c 100644 --- a/test/utils/streamedexec.go +++ b/test/utils/streamedexec.go @@ -102,7 +102,7 @@ func StreamedExecCommand(cmd *exec.Cmd, opts CommandOptions) error { return nil } -func consumeLines(r io.Reader, session *gexec.Session, opts CommandOptions) { +func consumeLines(r io.Reader, _ *gexec.Session, opts CommandOptions) { scanner := bufio.NewScanner(r) for scanner.Scan() { opts.OutputLineHandler(scanner.Text())