tests: Add unit tests for cgroup_compare_ignore_rule()
The following tests are in this commit:
NotAnIgnore() - Test that non-ignore rules are not processed
SimpleMatch() - Test that an ignore rule with a matching cgroup
and controller match
CgroupsDontMatch() - Test that cgroups with similar but not matching
names do not match
ControllersDontMatch() - Test that controllers with non-matching
names do not match
CombinedControllers() - Test that controllers that have been mounted
on the same path, e.g. cpu,cpuacct, can be matched by a rule
MatchChildFolder() - Compares a rule with a single-level hierarchy
with a rule that matches that hierarchy
MatchGrandchildFolder() - Compares a rule with a multi-level hierarchy
with a process that matches that hierachy
MatchSimilarChildFolder() - Compares a child folder that is similar
to the rule. This mimics a misconfiguration that a user could
make
RealWorldMatch() - Test that a realistic cgroup proc file matches
a new process
RealWorldNoMatch() - Test that a realistic cgroup proc file will
not match a new process
SimilarFolderNoMatch() - Compares a rule with a folder name that
is similar to the process' cgroup, but not a match
RootDestinationMatch() - Compares a rule with the root as the
destination and a process also running in the root cgroup
RootDestinationNoMatch() - Compares a rule with the root as the
destination and a process in another cgroup folder
The results from googletest are reported below:
[----------] 13 tests from CgroupCompareIgnoreRuleTest
[ RUN ] CgroupCompareIgnoreRuleTest.NotAnIgnore
[ OK ] CgroupCompareIgnoreRuleTest.NotAnIgnore (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.SimpleMatch
[ OK ] CgroupCompareIgnoreRuleTest.SimpleMatch (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.CgroupsDontMatch
[ OK ] CgroupCompareIgnoreRuleTest.CgroupsDontMatch (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.ControllersDontMatch
[ OK ] CgroupCompareIgnoreRuleTest.ControllersDontMatch (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.CombinedControllers
[ OK ] CgroupCompareIgnoreRuleTest.CombinedControllers (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.MatchChildFolder
[ OK ] CgroupCompareIgnoreRuleTest.MatchChildFolder (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.MatchGrandchildFolder
[ OK ] CgroupCompareIgnoreRuleTest.MatchGrandchildFolder (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.MatchSimilarChildFolder
[ OK ] CgroupCompareIgnoreRuleTest.MatchSimilarChildFolder (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.RealWorldMatch
[ OK ] CgroupCompareIgnoreRuleTest.RealWorldMatch (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.RealWorldNoMatch
[ OK ] CgroupCompareIgnoreRuleTest.RealWorldNoMatch (1 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.SimilarFolderNoMatch
[ OK ] CgroupCompareIgnoreRuleTest.SimilarFolderNoMatch (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.RootDestinationMatch
[ OK ] CgroupCompareIgnoreRuleTest.RootDestinationMatch (0 ms)
[ RUN ] CgroupCompareIgnoreRuleTest.RootDestinationNoMatch
[ OK ] CgroupCompareIgnoreRuleTest.RootDestinationNoMatch (0 ms)
[----------] 13 tests from CgroupCompareIgnoreRuleTest (3 ms total)
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>