From 29a7ee624ff486099621266ec549892d7fe8203c Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Wed, 4 Sep 2024 12:42:04 -0500 Subject: [PATCH] [chore] Fix flaky test in filelog receiver (#35012) Quick fix for https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/35007. Ideally we should not need to depend on order of files returned from the finder but there are apparently some subtle implications which need to be better understood before we remove the assumption. --- pkg/stanza/fileconsumer/matcher/internal/finder/finder.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/stanza/fileconsumer/matcher/internal/finder/finder.go b/pkg/stanza/fileconsumer/matcher/internal/finder/finder.go index 6d99edbbf8ec..caa447bda7ee 100644 --- a/pkg/stanza/fileconsumer/matcher/internal/finder/finder.go +++ b/pkg/stanza/fileconsumer/matcher/internal/finder/finder.go @@ -6,6 +6,7 @@ package finder // import "github.com/open-telemetry/opentelemetry-collector-cont import ( "errors" "fmt" + "slices" "github.com/bmatcuk/doublestar/v4" "golang.org/x/exp/maps" @@ -46,5 +47,7 @@ func FindFiles(includes []string, excludes []string) ([]string, error) { } } - return maps.Keys(allSet), errs + keys := maps.Keys(allSet) + slices.Sort(keys) + return keys, errs }