def testShouldHaveUsernameandAtLeastOneHostnameSetUp(self): self._setUpConfigFile() properties = Property(self.configfile) properties.parse_properties() logging.debug(properties.get_keys()) defaults = self._getDefaults() defaults.properties = properties logtailer = SSHLogTailer(defaults) self.assertTrue(logtailer.sanityCheck())
def testshouldBuildCommandTailBasedOnHostnamesDict(self): self._setUpConfigFile() properties = Property(self.configfile) properties.parse_properties() logging.debug(properties.get_keys()) defaults = self._getDefaults() defaults.properties = properties logtailer = SSHLogTailer(defaults) logtailer.sanityCheck() command = "tail -F /var/log/anylog555 /var/log/anylog1" logtailer.createCommands() self.assertEquals(command, logtailer.hostnames['hostname0']['command'])
def testItShouldhaveBuildADictWithAllParamsIfAllParametersOk(self): self._setUpConfigFile() properties = Property(self.configfile) properties.parse_properties() logging.debug(properties.get_keys()) defaults = self._getDefaults() defaults.properties = properties logtailer = SSHLogTailer(defaults) logtailer.sanityCheck() self.assertEquals(3, len(logtailer.hostnames.keys())) self.assertEquals('username', logtailer.hostnames['hostname0']['username'])
def testshouldBuildCommandTailBasedOnHostnamesDict(self): self._setUpConfigFile() properties = Property(self.configfile) properties.parse_properties() logging.debug(properties.get_keys()) defaults = self._getDefaults() defaults.properties = properties logtailer = SSHLogTailer(defaults) logtailer.sanityCheck() command = "tail -F /var/log/anylog555 /var/log/anylog1" logtailer.createCommands() self.assertEquals(command,logtailer.hostnames['hostname0']['command'])
def testItShouldhaveBuildADictWithAllParamsIfAllParametersOk(self): self._setUpConfigFile() properties = Property(self.configfile) properties.parse_properties() logging.debug(properties.get_keys()) defaults = self._getDefaults() defaults.properties = properties logtailer = SSHLogTailer(defaults) logtailer.sanityCheck() self.assertEquals(3,len(logtailer.hostnames.keys())) self.assertEquals('username', logtailer.hostnames['hostname0']['username'])