mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
@@ -25,6 +25,7 @@
|
||||
|
||||
namespace LibreNMS\Tests;
|
||||
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
class RrdDefinitionTest extends TestCase
|
||||
@@ -40,18 +41,16 @@ class RrdDefinitionTest extends TestCase
|
||||
*/
|
||||
public function testWrongType()
|
||||
{
|
||||
global $config;
|
||||
$config['rrd']['step'] = 300;
|
||||
$config['rrd']['heartbeat'] = 600;
|
||||
Config::set('rrd.step', 300);
|
||||
Config::set('rrd.heartbeat', 600);
|
||||
$def = new RrdDefinition();
|
||||
$def->addDataset('badtype', 'Something unexpected');
|
||||
}
|
||||
|
||||
public function testNameEscaping()
|
||||
{
|
||||
global $config;
|
||||
$config['rrd']['step'] = 300;
|
||||
$config['rrd']['heartbeat'] = 600;
|
||||
Config::set('rrd.step', 300);
|
||||
Config::set('rrd.heartbeat', 600);
|
||||
$expected = 'DS:bad_name-is_too_lon:GAUGE:600:0:100 ';
|
||||
$def = RrdDefinition::make()->addDataset('b a%d$_n:a^me-is_too_lon%g.', 'GAUGE', 0, 100, 600);
|
||||
|
||||
@@ -60,11 +59,10 @@ class RrdDefinitionTest extends TestCase
|
||||
|
||||
public function testCreation()
|
||||
{
|
||||
global $config;
|
||||
$config['rrd']['step'] = 300;
|
||||
$config['rrd']['heartbeat'] = 600;
|
||||
Config::set('rrd.step', 300);
|
||||
Config::set('rrd.heartbeat', 600);
|
||||
$expected = 'DS:pos:COUNTER:600:0:125000000000 ' .
|
||||
'DS:unbound:DERIVE:600:U:U ';
|
||||
'DS:unbound:DERIVE:600:U:U ';
|
||||
|
||||
$def = new RrdDefinition();
|
||||
$def->addDataset('pos', 'COUNTER', 0, 125000000000);
|
||||
|
Reference in New Issue
Block a user