Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <[email protected]>
  • Loading branch information
Pavel Okhlopkov committed Nov 2, 2024
1 parent 8c542ae commit 1f0d1f3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
22 changes: 11 additions & 11 deletions test/utils/jsonloganalyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 32 in test/utils/jsonloganalyzer.go

View workflow job for this annotation

GitHub Actions / Run unit tests

undefined: r

Check failure on line 32 in test/utils/jsonloganalyzer.go

View workflow job for this annotation

GitHub Actions / Run linter

undefined: r

Check failure on line 32 in test/utils/jsonloganalyzer.go

View workflow job for this annotation

GitHub Actions / Run linter

undefined: r
}

func (r *JsonLogAnalyzer) OnStop(fn func()) {
func (a *JsonLogAnalyzer) OnStop(fn func()) {
r.OnStopFn = fn

Check failure on line 36 in test/utils/jsonloganalyzer.go

View workflow job for this annotation

GitHub Actions / Run unit tests

undefined: r

Check failure on line 36 in test/utils/jsonloganalyzer.go

View workflow job for this annotation

GitHub Actions / Run linter

undefined: r) (typecheck)

Check failure on line 36 in test/utils/jsonloganalyzer.go

View workflow job for this annotation

GitHub Actions / Run linter

undefined: r (typecheck)
}

Expand All @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions test/utils/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
}

Expand Down
4 changes: 2 additions & 2 deletions test/utils/shell-operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion test/utils/streamedexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 1f0d1f3

Please sign in to comment.