def testMySQLDbSizePollerBasic(self): config = getConfig("/tmp") generator = utils.AlertGeneratorMock(config) try: poller = MySQLDbSizePoller(config.AlertGenerator.mysqlCPUPoller, generator) except Exception, ex: self.fail("%s: exception: %s" % (self.testName, ex))
def testMySQLDbSizePollerBasic(self): config = getConfig("/tmp") generator = utils.AlertGeneratorMock(config) try: poller = MySQLDbSizePoller(config.AlertGenerator.mysqlCPUPoller, generator) except Exception as ex: self.fail("%s: exception: %s" % (self.testName, ex)) poller.check() # test failing during set up poller = MySQLDbSizePoller(config.AlertGenerator.mysqlCPUPoller, generator) poller._query = "nonsense query" # this will fail on the above query self.assertRaises(Exception, poller._getDbDir) poller.check()
ti.expected = 0 ti.thresholdDiff = 10 ti.testCase = self utils.doGenericPeriodAndProcessPolling(ti) def testMySQLDbSizePollerBasic(self): config = getConfig("/tmp") generator = utils.AlertGeneratorMock(config) try: poller = MySQLDbSizePoller(config.AlertGenerator.mysqlCPUPoller, generator) except Exception, ex: self.fail("%s: exception: %s" % (self.testName, ex)) poller.check() # test failing during set up poller = MySQLDbSizePoller(config.AlertGenerator.mysqlCPUPoller, generator) poller._query = "nonsense query" poller._dbDirectory = poller._getDbDir() poller.check() self.assertEquals(poller._dbDirectory, None) def testAlertGeneratorMySQLDbSizePollerSoftThreshold(self): self.config.AlertGenerator.mysqlDbSizePoller.soft = 5 self.config.AlertGenerator.mysqlDbSizePoller.critical = 10 self.config.AlertGenerator.mysqlDbSizePoller.pollInterval = 0.2 ti = utils.TestInput() # see attributes comments at the class ti.pollerClass = MySQLDbSizePoller ti.config = self.config.AlertGenerator.mysqlDbSizePoller ti.thresholdToTest = self.config.AlertGenerator.mysqlDbSizePoller.soft ti.level = self.config.AlertProcessor.soft.level ti.expected = 1
ti.thresholdDiff = 10 ti.testCase = self utils.doGenericPeriodAndProcessPolling(ti) def testMySQLDbSizePollerBasic(self): config = getConfig("/tmp") generator = utils.AlertGeneratorMock(config) try: poller = MySQLDbSizePoller(config.AlertGenerator.mysqlCPUPoller, generator) except Exception, ex: self.fail("%s: exception: %s" % (self.testName, ex)) poller.check() # test failing during set up poller = MySQLDbSizePoller(config.AlertGenerator.mysqlCPUPoller, generator) poller._query = "nonsense query" # this will fail on the above query self.assertRaises(Exception, poller._getDbDir) poller.check() def testAlertGeneratorMySQLDbSizePollerSoftThreshold(self): self.config.AlertGenerator.mysqlDbSizePoller.soft = 5 self.config.AlertGenerator.mysqlDbSizePoller.critical = 10 self.config.AlertGenerator.mysqlDbSizePoller.pollInterval = 0.2 ti = utils.TestInput() # see attributes comments at the class ti.pollerClass = MySQLDbSizePoller ti.config = self.config.AlertGenerator.mysqlDbSizePoller ti.thresholdToTest = self.config.AlertGenerator.mysqlDbSizePoller.soft ti.level = self.config.AlertProcessor.soft.level