mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-13 16:03:20 -05:00
parent
857913172b
commit
962faab992
3 changed files with 55 additions and 2 deletions
|
|
@ -42,7 +42,7 @@ class HostNodeTest extends BaseTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Icinga\Exception\ConfigurationError
|
||||
* @expectedException \Icinga\Exception\ProgrammingError
|
||||
*/
|
||||
public function testWhetherSettingAnInvalidStateFails()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -143,6 +143,60 @@ class AndOperatorTest extends BaseTestCase
|
|||
$this->assertEquals('WARNING', $p->getStateName());
|
||||
}
|
||||
|
||||
public function testWhetherPendingIsAccepted()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$host = $bp->createHost('localhost')->setState(99);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(99);
|
||||
$p = $bp->createBp('p')
|
||||
->addChild($host)
|
||||
->addChild($service);
|
||||
|
||||
$this->assertEquals(
|
||||
'PENDING',
|
||||
$p->getStateName()
|
||||
);
|
||||
}
|
||||
|
||||
public function testWhetherWarningIsWorseThanPending()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$host = $bp->createHost('localhost')->setState(99);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(1);
|
||||
$p = $bp->createBp('p')
|
||||
->addChild($host)
|
||||
->addChild($service);
|
||||
|
||||
$this->assertEquals(
|
||||
'WARNING',
|
||||
$p->getStateName()
|
||||
);
|
||||
}
|
||||
|
||||
public function testWhetherPendingIsWorseThanUpOrOk()
|
||||
{
|
||||
$bp = new BusinessProcess();
|
||||
$host = $bp->createHost('localhost')->setState(99);
|
||||
$service = $bp->createService('localhost', 'ping')->setState(0);
|
||||
$p = $bp->createBp('p')
|
||||
->addChild($host)
|
||||
->addChild($service);
|
||||
|
||||
$this->assertEquals(
|
||||
'PENDING',
|
||||
$p->getStateName()
|
||||
);
|
||||
|
||||
$p->clearState();
|
||||
$host->setState(0);
|
||||
$service->setState(99);
|
||||
|
||||
$this->assertEquals(
|
||||
'PENDING',
|
||||
$p->getStateName()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BusinessProcess
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ namespace Tests\Icinga\Module\Businessprocess\Operator;
|
|||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\ServiceNode;
|
||||
use Icinga\Module\Businessprocess\Test\BaseTestCase;
|
||||
use Icinga\Web\View;
|
||||
|
||||
class ServiceNodeTest extends BaseTestCase
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue