Skip to content

Commit

Permalink
[receiver/filelog] Add test cases for recursive globs (#32188)
Browse files Browse the repository at this point in the history
**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 5, 2024
1 parent 3ab6693 commit af3c7fe
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 @@ -712,7 +712,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 af3c7fe

Please sign in to comment.