예제 #1
0
 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())
예제 #2
0
 def testIfParametersNotProvidedShouldExit(self):
     fh = open('wrongconfigfile','w')
     fh.write('anything = anything\n')
     fh.close()
     properties = Property('wrongconfigfile')
     properties.parse_properties()
     defaults = self.__getDefaults()
     defaults['properties'] = properties
     logtailer = SSHLogTailer(defaults)
     self.assertFalse(logtailer.sanityCheck())
예제 #3
0
 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'])
예제 #4
0
 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'])