Skip to content

Commit

Permalink
Fix integration tests framework
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed May 21, 2024
1 parent 90af8c8 commit 8711a57
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libbeat/tests/integration/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func (b *BeatProc) Stop() {
func (b *BeatProc) LogMatch(match string) bool {
re := regexp.MustCompile(match)
logFile := b.openLogFile()
defer logFile.Close()

found := false

Check failure on line 295 in libbeat/tests/integration/framework.go

View workflow job for this annotation

GitHub Actions / lint (linux)

assigned to found, but reassigned without using the value (wastedassign)
found, b.logFileOffset = b.logRegExpMatch(re, logFile, b.logFileOffset)
Expand All @@ -298,6 +299,10 @@ func (b *BeatProc) LogMatch(match string) bool {
}

eventLogFile := b.openEventLogFile()
if eventLogFile == nil {
return false
}
defer eventLogFile.Close()
found, b.eventLogFileOffset = b.logRegExpMatch(re, eventLogFile, b.eventLogFileOffset)

return found
Expand Down Expand Up @@ -479,6 +484,8 @@ func (b *BeatProc) openGlobFile(glob string, waitForFile bool) *os.File {

// openLogFile opens the log file for reading and returns it.
// It's the caller's responsibility to close the file.
// If the log file is not found, the test fails. The returned
// value is never nil.
func (b *BeatProc) openLogFile() *os.File {
// Beats can produce two different log files, to make sure we're
// reading the normal one we add the year to the glob. The default
Expand Down

0 comments on commit 8711a57

Please sign in to comment.