def testParseSysctl(self): """Sysctl entries return an underscore separated key and 0+ values.""" parser = linux_sysctl_parser.ProcSysParser() paths = ["/proc/sys/net/ipv4/ip_forward", "/proc/sys/kernel/printk"] vals = ["0", "3 4 1 3"] pathspecs, files = self._GenTestData(paths, vals) results = list(parser.ParseFiles(None, pathspecs, files)) self.assertLen(results, 1) self.assertIsInstance(results[0], rdf_protodict.AttributedDict) self.assertEqual("0", results[0].net_ipv4_ip_forward) self.assertEqual(["3", "4", "1", "3"], results[0].kernel_printk)
def setUpClass(cls): super(SysctlTests, cls).setUpClass() cls.LoadCheck("sysctl.yaml") cls.parser = linux_sysctl_parser.ProcSysParser()