Code

store_lookup_test: Ensure that filters are applied before matchers.
authorSebastian Harl <sh@tokkee.org>
Fri, 31 Oct 2014 16:13:20 +0000 (17:13 +0100)
committerSebastian Harl <sh@tokkee.org>
Fri, 31 Oct 2014 16:13:20 +0000 (17:13 +0100)
t/unit/core/store_lookup_test.c

index 931c4f2097d75200516f8ac2e20aa2f4320eab88..698226e23db360ac792a9a4776821c71da20e0f6 100644 (file)
@@ -538,6 +538,8 @@ START_TEST(test_scan)
                        "NOT attribute['x'] = ''",         2 }, /* filter always matches */
                { "ANY metric =~ 'm'", NULL,           2 },
                { "ALL metric =~ 'm'", NULL,           3 },
                        "NOT attribute['x'] = ''",         2 }, /* filter always matches */
                { "ANY metric =~ 'm'", NULL,           2 },
                { "ALL metric =~ 'm'", NULL,           3 },
+               { "ANY metric =~ 'm'", "name !~ '1'",  1 },
+               { "ANY metric =~ 'm'", "name !~ 'm'",  0 },
                { "ALL metric =~ '1'", NULL,           2 },
                { "ALL metric =~ '2'", NULL,           1 },
                { "ANY metric !~ 'm'", NULL,           0 },
                { "ALL metric =~ '1'", NULL,           2 },
                { "ALL metric =~ '2'", NULL,           1 },
                { "ANY metric !~ 'm'", NULL,           0 },
@@ -548,18 +550,26 @@ START_TEST(test_scan)
                { "ANY service = 's1'",
                        "NOT attribute['x'] = ''",         2 }, /* filter always matches */
                { "ANY service =~ 's'", NULL,          2 },
                { "ANY service = 's1'",
                        "NOT attribute['x'] = ''",         2 }, /* filter always matches */
                { "ANY service =~ 's'", NULL,          2 },
+               { "ANY service =~ 's'", "name !~ 's'", 0 },
+               { "ANY service =~ 's'", "name !~ '1'", 2 },
                { "ANY service !~ 's'", NULL,          0 },
                { "ANY attribute = 'k1'", NULL,        2 },
                { "ANY attribute = 'k1'", "host = 'x'",0 }, /* filter never matches */
                { "ANY attribute = 'k1'",
                        "NOT attribute['x'] = ''",         2 }, /* filter always matches */
                { "ANY attribute =~ 'k'", NULL,        2 },
                { "ANY service !~ 's'", NULL,          0 },
                { "ANY attribute = 'k1'", NULL,        2 },
                { "ANY attribute = 'k1'", "host = 'x'",0 }, /* filter never matches */
                { "ANY attribute = 'k1'",
                        "NOT attribute['x'] = ''",         2 }, /* filter always matches */
                { "ANY attribute =~ 'k'", NULL,        2 },
+               { "ANY attribute =~ 'k'",
+                       "name !~ '1'",                     1 },
+               { "ANY attribute =~ 'k'",
+                       "name !~ 'k'",                     0 },
                { "ANY attribute =~ '1'", NULL,        2 },
                { "ANY attribute =~ '2'", NULL,        1 },
                { "ANY attribute = 'x'", NULL,         0 },
                { "ANY attribute =~ 'x'", NULL,        0 },
                { "ALL attribute = 'k1'", NULL,        2 },
                { "attribute['k1'] = 'v1'", NULL,      1 },
                { "ANY attribute =~ '1'", NULL,        2 },
                { "ANY attribute =~ '2'", NULL,        1 },
                { "ANY attribute = 'x'", NULL,         0 },
                { "ANY attribute =~ 'x'", NULL,        0 },
                { "ALL attribute = 'k1'", NULL,        2 },
                { "attribute['k1'] = 'v1'", NULL,      1 },
+               { "attribute['k1'] = 'v1'",
+                       "name != 'k1'",                    0 },
                { "attribute['k1'] =~ 'v1'", NULL,     1 },
                { "attribute['k1'] =~ '^v1$'", NULL,   1 },
                { "attribute['k1'] =~ 'v'", NULL,      2 },
                { "attribute['k1'] =~ 'v1'", NULL,     1 },
                { "attribute['k1'] =~ '^v1$'", NULL,   1 },
                { "attribute['k1'] =~ 'v'", NULL,      2 },