You are here

function MonitoringMuninTest::testMultigraphsAPI in Monitoring 7

Tests the multigraph API/CRUD

File

modules/monitoring_munin/monitoring_munin.test, line 36
Monitoring munin tests.

Class

MonitoringMuninTest
Class MonitoringAPITest

Code

function testMultigraphsAPI() {

  // Test adding a multigraph.
  monitoring_munin_multigraph_save('test multigraph', 'test unit');
  $multigraphs = monitoring_munin_multigraphs();
  $this
    ->assertEqual($multigraphs['test multigraph']['title'], 'test multigraph');
  $this
    ->assertEqual($multigraphs['test multigraph']['vlabel'], 'test unit');

  // Add multigraph to a sensor.
  $settings = monitoring_sensor_settings_get('dblog_404');
  $settings['munin']['multigraphs'][] = 'test multigraph';
  monitoring_sensor_settings_save('dblog_404', $settings);

  // Deleting the multigraph must remove it form sensors settings as well.
  monitoring_munin_multigraph_delete('test multigraph');
  monitoring_sensor_manager()
    ->resetCache();
  $info = $this->sensorManager
    ->getSensorInfoByName('dblog_404');
  $munin_settings = $info
    ->getSetting('munin');
  $this
    ->assertTrue(!in_array('test multigraph', $munin_settings['multigraphs']));
}