Skip to content

Commit

Permalink
auditbeat TestExeObjParser - fix errors.Is argument order (#38606) (#…
Browse files Browse the repository at this point in the history
…38630)

The arguments to errors.Is are in the wrong order so the check
is not working as designed and test is never skipped.

Also stop the test after exeObjParser.Parse fails.

Relates: #38211
(cherry picked from commit cd89cc4)

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
  • Loading branch information
mergify[bot] and andrewkroh authored Mar 26, 2024
1 parent 95271b3 commit 2793657
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions auditbeat/module/file_integrity/exeobjparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ func TestExeObjParser(t *testing.T) {
}

if _, ci := os.LookupEnv("CI"); ci {
if _, err := os.Stat(target); err != nil && errors.Is(fs.ErrNotExist, err) {
if _, err := os.Stat(target); err != nil && errors.Is(err, fs.ErrNotExist) {
t.Skip("skipping test because target binary was not found: see https://github.com/elastic/beats/issues/38211")
}
}

got := make(mapstr.M)
err := exeObjParser(nil).Parse(got, target)
if err != nil {
t.Errorf("unexpected error calling exeObjParser.Parse: %v", err)
t.Fatalf("unexpected error calling exeObjParser.Parse: %v", err)
}

fields := []struct {
Expand Down

0 comments on commit 2793657

Please sign in to comment.