Skip to content

Commit

Permalink
Fix TestNewModuleRegistry flakiness (#30453)
Browse files Browse the repository at this point in the history
Must sort filesets before comparing them, as they come from a map, so
the iteration order is random.
  • Loading branch information
adriansr authored Feb 17, 2022
1 parent 79229e7 commit 8ab92d8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions filebeat/fileset/modules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"errors"
"fmt"
"path/filepath"
"sort"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -101,6 +102,8 @@ func TestNewModuleRegistry(t *testing.T) {
for _, fileset := range module.filesets {
filesetList = append(filesetList, fileset.name)
}
sort.Strings(filesetList)
sort.Strings(expectedFilesets)
assert.Equal(t, filesetList, expectedFilesets)
}

Expand Down

0 comments on commit 8ab92d8

Please sign in to comment.