From cd89cc463d9c3d573f66dbfc2932e4343d577ee1 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Tue, 26 Mar 2024 14:41:09 -0400 Subject: [PATCH] auditbeat TestExeObjParser - fix errors.Is argument order (#38606) 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 --- auditbeat/module/file_integrity/exeobjparser_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auditbeat/module/file_integrity/exeobjparser_test.go b/auditbeat/module/file_integrity/exeobjparser_test.go index f8ca144e4ed9..9952cd7825b4 100644 --- a/auditbeat/module/file_integrity/exeobjparser_test.go +++ b/auditbeat/module/file_integrity/exeobjparser_test.go @@ -48,7 +48,7 @@ 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") } } @@ -56,7 +56,7 @@ func TestExeObjParser(t *testing.T) { 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 {