Skip to content

Commit

Permalink
Fix: skip packages without data streams in coverage calculation (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtojek authored Jul 22, 2021
1 parent a8f6d9e commit 0370a78
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/testrunner/coverageoutput.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,16 @@ func collectTestCoverageDetails(packageRootPath, packageName string, testType Te
}

func findDataStreamsWithoutTests(packageRootPath string, testType TestType) ([]string, error) {
var noTests []string

dataStreamDir := filepath.Join(packageRootPath, "data_stream")
dataStreams, err := ioutil.ReadDir(dataStreamDir)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return noTests, nil // there are packages that don't have any data streams (fleet_server, security_detection_engine)
} else if err != nil {
return nil, errors.Wrap(err, "can't list data streams directory")
}

var noTests []string
for _, dataStream := range dataStreams {
if !dataStream.IsDir() {
continue
Expand Down

0 comments on commit 0370a78

Please sign in to comment.