Skip to content

Commit

Permalink
auditbeat TestExeObjParser - fix errors.Is argument order (#38606)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
andrewkroh authored and mergify[bot] committed Mar 26, 2024
1 parent 9038179 commit 755054f
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 755054f

Please sign in to comment.