Skip to content

Commit

Permalink
auditbeat - skip TestExeObjParser on CI
Browse files Browse the repository at this point in the history
TestExeObjParser fails on Windows because Defender is removing the
testdata that is required by the test. This adds a conditional test
skip for CI when those files are missing.

Closes #38211
  • Loading branch information
andrewkroh committed Mar 19, 2024
1 parent 4a3da80 commit 85e62bf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions auditbeat/module/file_integrity/exeobjparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
package file_integrity

import (
"errors"
"fmt"
"io/fs"
"math"
"os"
"reflect"
"strconv"
"testing"
Expand All @@ -44,6 +47,12 @@ func TestExeObjParser(t *testing.T) {
t.Skip("skipping test on garbled PE file: see https://github.com/elastic/beats/issues/35705")
}

if _, ci := os.LookupEnv("CI"); ci {
if _, err := os.Stat(target); err != nil && errors.Is(fs.ErrNotExist, err) {
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 {
Expand Down

0 comments on commit 85e62bf

Please sign in to comment.