예제 #1
0
 def test_at_least_one_checktype_enabled(self):
     self.mocks['check_growth.ScriptConfiguration'].get_val.side_effect = \
         self._script_conf_factory(memory_mon_enabled=False,
                                   disk_mon_enabled=False,)
     with self.assertRaises(SystemExit):
         check_growth.verify_conf()
     status, msg = self.mocks['check_growth.ScriptStatus'].notify_immediate.call_args[0]
     self.assertEqual(status, 'unknown')
     self.assertIn('There should be at least one resourece check enabled.',
                   msg)
예제 #2
0
 def test_limits_sanity(self):
     self.mocks['check_growth.ScriptConfiguration'].get_val.side_effect = \
         self._script_conf_factory(memory_mon_warn_reduction=30,
                                   memory_mon_crit_reduction=20,
                                   disk_mon_warn_reduction=10,
                                   disk_mon_crit_reduction=5)
     with self.assertRaises(SystemExit):
         check_growth.verify_conf()
     status, msg = self.mocks['check_growth.ScriptStatus'].notify_immediate.call_args[0]
     self.assertEqual(status, 'unknown')
     self.assertIn('memory_mon_warn_reduction should be lower ' +
                   'than memory_mon_crit_reduction', msg)
     self.assertIn('disk_mon_warn_reduction should be lower than ' +
                   'disk_mon_crit_reduction', msg)
예제 #3
0
 def test_values_greater_than_zero(self):
     self.mocks['check_growth.ScriptConfiguration'].get_val.side_effect = \
         self._script_conf_factory(timeframe=-7,
                                   max_averaging_window=-3,
                                   memory_mon_warn_reduction=-10,
                                   memory_mon_crit_reduction=-100,
                                   disk_mon_warn_reduction=0,
                                   disk_mon_crit_reduction=-5)
     with self.assertRaises(SystemExit):
         check_growth.verify_conf()
     status, msg = self.mocks['check_growth.ScriptStatus'].notify_immediate.call_args[0]
     self.assertEqual(status, 'unknown')
     self.assertIn('Timeframe should be a positive int', msg)
     self.assertIn('Max averaging window should be a positive int', msg)
     self.assertIn('memory_mon_warn_reduction should be a positive int', msg)
     self.assertIn('memory_mon_crit_reduction should be a positive int', msg)
     self.assertIn('disk_mon_warn_reduction should be a positive int', msg)
     self.assertIn('disk_mon_crit_reduction should be a positive int', msg)
예제 #4
0
 def test_configuration_ok(self):
     self.mocks['check_growth.ScriptConfiguration'].get_val.side_effect = \
         self._script_conf_factory(disk_mountpoints=paths.MOUNTPOINT_DIRS)
     check_growth.verify_conf()