Esempio n. 1
0
  def testcover_check_collectd_WHEN_state_critical(
      self, mock_collectd_installed):
    mock_collectd_installed.side_effect = (
        check_collectd_mlab.CriticalError('fail'))

    state, _ = check_collectd_mlab.check_collectd()

    self.assertEqual(state, check_collectd_mlab.STATE_CRITICAL)
    self.assertTrue(mock_collectd_installed.called)
Esempio n. 2
0
  def testcover_check_collectd(
      self, mock_last_sync_time, mock_collectd_nagios_levels, mock_vsys_setup,
      mock_collectd_responds, mock_collectd_installed):
    state, _ = check_collectd_mlab.check_collectd()

    self.assertEqual(state, check_collectd_mlab.STATE_OK)
    self.assertTrue(mock_collectd_installed.called)
    self.assertTrue(mock_collectd_responds.called)
    self.assertTrue(mock_vsys_setup.called)
    self.assertTrue(mock_collectd_nagios_levels.called)
    self.assertTrue(mock_last_sync_time.called)
Esempio n. 3
0
  def testcover_check_collectd_WHEN_nagios_error(
      self, mock_last_sync_time, mock_collectd_nagios_levels, mock_vsys_setup,
      mock_collectd_responds, mock_collectd_installed):
    mock_collectd_nagios_levels.side_effect = (
        check_collectd_mlab.NagiosStateError('error'))

    state, message = check_collectd_mlab.check_collectd()

    self.assertEqual(state, check_collectd_mlab.STATE_UNKNOWN)
    self.assertEqual(message, 'error')
    self.assertTrue(mock_collectd_installed.called)
    self.assertTrue(mock_collectd_responds.called)
    self.assertTrue(mock_vsys_setup.called)
    self.assertTrue(mock_collectd_nagios_levels.called)
    self.assertTrue(mock_last_sync_time.called)