Skip to content

Update Go to 1.13.3#14335

Merged
mikemadden42 merged 8 commits intoelastic:masterfrom
mikemadden42:update-go-1.13.3
Nov 1, 2019
Merged

Update Go to 1.13.3#14335
mikemadden42 merged 8 commits intoelastic:masterfrom
mikemadden42:update-go-1.13.3

Conversation

@mikemadden42
Copy link
Copy Markdown
Contributor

No description provided.

@mikemadden42 mikemadden42 requested review from a team as code owners October 30, 2019 17:45
@urso
Copy link
Copy Markdown

urso commented Oct 30, 2019

LGTM. Let's see what CI thinks.

@andrewkroh
Copy link
Copy Markdown
Member

run beats-ci/package

@urso urso mentioned this pull request Nov 1, 2019
@andrewkroh
Copy link
Copy Markdown
Member

The auditbeat test failure is also related to initialization of testing flags. Here's the fix:

diff --git a/auditbeat/module/file_integrity/eventreader_fsevents.go b/auditbeat/module/file_integrity/eventreader_fsevents.go
index e9f5384e7..c22994838 100644
--- a/auditbeat/module/file_integrity/eventreader_fsevents.go
+++ b/auditbeat/module/file_integrity/eventreader_fsevents.go
@@ -20,7 +20,6 @@
 package file_integrity
 
 import (
-       "flag"
        "os"
        "path/filepath"
        "strings"
@@ -34,10 +33,6 @@ import (
 
 var underTest = false
 
-func init() {
-       underTest = flag.Lookup("test.v") != nil
-}
-
 type fsreader struct {
        stream      *fsevents.EventStream
        config      Config
diff --git a/auditbeat/module/file_integrity/eventreader_test.go b/auditbeat/module/file_integrity/eventreader_test.go
index f444aa6ea..6d9b02f78 100644
--- a/auditbeat/module/file_integrity/eventreader_test.go
+++ b/auditbeat/module/file_integrity/eventreader_test.go
@@ -32,6 +32,10 @@ import (
        "github.com/stretchr/testify/assert"
 )
 
+func init() {
+       underTest = true
+}
+
 // ErrorSharingViolation is a Windows ERROR_SHARING_VIOLATION. It means "The
 // process cannot access the file because it is being used by another process."
 const ErrorSharingViolation syscall.Errno = 32

@mikemadden42 mikemadden42 requested a review from adriansr November 1, 2019 18:03
@urso
Copy link
Copy Markdown

urso commented Nov 1, 2019

@andrewkroh What is the impact of setting underTest to true, always. Maybe we want to have a lazy call in the module constructor using sync.Once. Like:

var (
  underTest bool
  initUnderTest sync.Once
)

func checkUnderTest() bool {
  initUnderTest.Do(func() {
    ...
  })
}

@andrewkroh
Copy link
Copy Markdown
Member

The underTest variable is set once from a _test.go file during package initialization. It causes the file monitor to react to events generated by the testing process (normally it ignores events triggered by itself). So I think it should be fine to just set directly during initialization.

@urso
Copy link
Copy Markdown

urso commented Nov 1, 2019

Makes sense. Thanks for the clarification. In this sense I'd say that your proposed change even makes this a little cleaner.

@mikemadden42 mikemadden42 merged commit ab3def8 into elastic:master Nov 1, 2019
@mikemadden42 mikemadden42 deleted the update-go-1.13.3 branch November 1, 2019 21:10
jorgemarey pushed a commit to jorgemarey/beats that referenced this pull request Jun 8, 2020
* Update Go to 1.13.3
* Register flags in the new testing.Init function for Go 1.13.
* Update tz data
* Fix eventreader test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants