Private GIT

Skip to content
Snippets Groups Projects
Commit edd19420 authored by Matthieu Mandoula's avatar Matthieu Mandoula Committed by Kev
Browse files

LimitMetricInChart acceptance test updated (#5471)

* put clipboard on app head and remove old lib tool.js

* LimitMetricInChart acceptance test updated, the background has been changed from "I am logged in a Centreon server" to "I am logged in a Centreon server with a configured metrics" then the "given" step of the first scenario has been removed and attributes values changed as well

* Update LimitMetricInChart.feature
parent 4cfe610e
No related branches found
No related tags found
No related merge requests found
...@@ -4,10 +4,9 @@ Feature: Limit metrics in chart ...@@ -4,10 +4,9 @@ Feature: Limit metrics in chart
So that i will not crash my browser So that i will not crash my browser
Background: Background:
Given I am logged in a Centreon server Given I am logged in a Centreon server with configured metrics
Scenario: Display message and button in performance page Scenario: Display message and button in performance page
Given a service with several metrics
When I display the chart in performance page When I display the chart in performance page
Then a message says that the chart will not be displayed Then a message says that the chart will not be displayed
And a button is available to display the chart And a button is available to display the chart
<?php <?php
use Centreon\Test\Behat\CentreonContext; use Centreon\Test\Behat\CentreonContext;
use Centreon\Test\Behat\Configuration\HostConfigurationPage;
use Centreon\Test\Behat\Configuration\ServiceConfigurationPage;
use Centreon\Test\Behat\Monitoring\ServiceMonitoringDetailsPage;
use Centreon\Test\Behat\Monitoring\GraphMonitoringPage; use Centreon\Test\Behat\Monitoring\GraphMonitoringPage;
class LimitMetricInChartContext extends CentreonContext class LimitMetricInChartContext extends CentreonContext
{ {
private $hostName = 'LimitMetricInChartTestHost'; private $hostName = 'MetricTestHostname';
private $serviceName = 'LimitMetricInChartTestService'; private $serviceName = 'MetricTestService';
private $chartPage = null; private $chartPage = null;
/**
* @Given a service with several metrics
*/
public function aServiceWithSeveralMetrics()
{
// Create host.
$hostConfig = new HostConfigurationPage($this);
$hostProperties = array(
'name' => $this->hostName,
'alias' => $this->hostName,
'address' => 'localhost',
'max_check_attempts' => 1,
'normal_check_interval' => 1,
'retry_check_interval' => 1,
'active_checks_enabled' => "0",
'passive_checks_enabled' => "1"
);
$hostConfig->setProperties($hostProperties);
$hostConfig->save();
// Create service.
$serviceConfig = new ServiceConfigurationPage($this);
$serviceProperties = array(
'description' => $this->serviceName,
'hosts' => $this->hostName,
'templates' => 'generic-service',
'check_command' => 'check_centreon_dummy',
'check_period' => '24x7',
'active_checks_enabled' => "0",
'passive_checks_enabled' => "1"
);
$serviceConfig->setProperties($serviceProperties);
$serviceConfig->save();
// Ensure service is monitored.
$this->restartAllPollers();
sleep(7);
// Send multiple perfdata.
$perfdata = '';
for ($i = 0; $i < 20; $i++) {
$perfdata .= 'test' . $i . '=1s ';
}
$this->submitServiceResult($this->hostName, $this->serviceName, 'OK', 'OK', $perfdata);
// Ensure perfdata were processed.
$this->spin(
function ($context) {
$page = new ServiceMonitoringDetailsPage(
$context,
$context->hostName,
$context->serviceName
);
$properties = $page->getProperties();
if (count($properties['perfdata']) < 20) {
return false;
}
return true;
},
'Cannot get performance data of ' . $this->hostName . ' / ' . $this->serviceName
);
}
/** /**
* @When I display the chart in performance page * @When I display the chart in performance page
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment