Skip to content

Commit

Permalink
[receiver/filelog] Add test cases for recursive globs (open-telemetry…
Browse files Browse the repository at this point in the history
…#32188)

**Description:**

This PR adds a couple of unit test cases exercising recursive glob
(`**`) usage in the `include` and `exclude` options of the `filelog`
receiver.
  • Loading branch information
ycombinator committed Apr 9, 2024
1 parent 409ac3b commit afb7f0c
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion pkg/stanza/fileconsumer/matcher/matcher_test.go
Expand Up @@ -720,7 +720,40 @@ func TestMatcher(t *testing.T) {
},
expected: []string{"err.b.1.2023020602.log"},
},
}
{
name: "Recursive match - include",
files: []string{
"a/1.log",
"a/2.log",
"a/b/1.log",
"a/b/2.log",
"a/b/c/1.log",
"a/b/c/2.log",
},
include: []string{"**/1.log"},
exclude: []string{},
expected: []string{
"a/1.log",
"a/b/1.log",
"a/b/c/1.log",
},
},
{
name: "Recursive match - include and exclude",
files: []string{
"a/1.log",
"a/2.log",
"a/b/1.log",
"a/b/2.log",
"a/b/c/1.log",
"a/b/c/2.log",
},
include: []string{"**/1.log"},
exclude: []string{"**/b/**/1.log"},
expected: []string{
"a/1.log",
},
}}

for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
Expand Down

0 comments on commit afb7f0c

Please sign in to comment.