@@ -8,7 +8,7 @@ using namespace NMonitoring::NAudit;
8
8
Y_UNIT_TEST_SUITE (TUrlMatcherTest) {
9
9
Y_UNIT_TEST (MatchExactPathOnly) {
10
10
NMonitoring::NAudit::TUrlMatcher matcher;
11
- matcher.AddPattern ({.Path = " /a/b/c" });
11
+ matcher.AddPattern ({.Path = " /a/b/c" , . Recursive = false });
12
12
13
13
UNIT_ASSERT (matcher.Match (" /a/b/c" ));
14
14
UNIT_ASSERT (matcher.Match (" a/b/c" ));
@@ -24,48 +24,19 @@ Y_UNIT_TEST_SUITE(TUrlMatcherTest) {
24
24
UNIT_ASSERT (!matcher.Match (" //a/b/c" ));
25
25
UNIT_ASSERT (!matcher.Match (" /a/b///c" ));
26
26
UNIT_ASSERT (!matcher.Match (" /a/b/c/d" ));
27
+ UNIT_ASSERT (!matcher.Match (" /a/b/c/d/e/f" ));
27
28
}
28
29
29
- Y_UNIT_TEST (MatchWithParamNameOnly ) {
30
+ Y_UNIT_TEST (MatchRecursive ) {
30
31
NMonitoring::NAudit::TUrlMatcher matcher;
31
- matcher.AddPattern ({.Path = " /a/b" , .ParamName = " mode" });
32
-
33
- UNIT_ASSERT (matcher.Match (" /a/b?mode=" ));
34
- UNIT_ASSERT (matcher.Match (" /a/b?mode=" ));
35
- UNIT_ASSERT (matcher.Match (" /a/b?mode=1" ));
36
- UNIT_ASSERT (matcher.Match (" /a/b?other=1&mode=1" ));
37
-
38
- UNIT_ASSERT (!matcher.Match (" /a/b" ));
39
- UNIT_ASSERT (!matcher.Match (" /a?mode=1" ));
40
- UNIT_ASSERT (!matcher.Match (" /a/b?other=1" ));
41
- UNIT_ASSERT (!matcher.Match (" /a/b/c?mode=1" ));
42
- }
43
-
44
- Y_UNIT_TEST (MatchWithParamNameAndValue) {
45
- NMonitoring::NAudit::TUrlMatcher matcher;
46
- matcher.AddPattern ({.Path = " /a/b" , .ParamName = " action" , .ParamValue = " start" });
47
- matcher.AddPattern ({.Path = " /a/b" , .ParamName = " action" , .ParamValue = " stop" });
48
-
49
- UNIT_ASSERT (matcher.Match (" /a/b?action=start" ));
50
- UNIT_ASSERT (matcher.Match (" /a/b?action=stop" ));
51
- UNIT_ASSERT (matcher.Match (" /a/b?k=stop&action=start" ));
52
-
53
- UNIT_ASSERT (!matcher.Match (" /a/b" ));
54
- UNIT_ASSERT (!matcher.Match (" /a/b?action=restart" ));
55
- UNIT_ASSERT (!matcher.Match (" /a/b?k=stop" ));
56
- UNIT_ASSERT (!matcher.Match (" /a/b/c?action=start" ));
57
- }
58
-
59
- Y_UNIT_TEST (MatchWithWildcardPath) {
60
- NMonitoring::NAudit::TUrlMatcher matcher;
61
- matcher.AddPattern ({.Path = " /actors/blobstorageproxies/*" , .ParamName = " PutSamplingRate" });
32
+ matcher.AddPattern ({.Path = " /actors/blobstorageproxies" , .Recursive = true });
62
33
34
+ UNIT_ASSERT (matcher.Match (" /actors/blobstorageproxies" ));
35
+ UNIT_ASSERT (matcher.Match (" /actors/blobstorageproxies/blobstorageproxy2181038080" ));
63
36
UNIT_ASSERT (matcher.Match (" /actors/blobstorageproxies/blobstorageproxy2181038080?PutSamplingRate=1" ));
64
37
UNIT_ASSERT (matcher.Match (" /actors/blobstorageproxies/somethingelse?PutSamplingRate=123" ));
65
38
66
- UNIT_ASSERT (!matcher.Match (" /actors/blobstorageproxies" ));
67
- UNIT_ASSERT (!matcher.Match (" /actors/blobstorageproxies/blobstorageproxy2181038080" ));
68
- UNIT_ASSERT (!matcher.Match (" /actors/blobstorageproxies/blobstorageproxy2181038080?OtherParam=1" ));
39
+ UNIT_ASSERT (!matcher.Match (" /actors/blobstorageproxies123" ));
69
40
UNIT_ASSERT (!matcher.Match (" /actors/otherproxy/blobstorageproxy2181038080?PutSamplingRate=1" ));
70
41
}
71
42
}
0 commit comments