mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-26 03:09:11 +02:00
fix-multiple-test-runs
This commit is contained in:
parent
12cca3ebcf
commit
a1fc75f745
@ -12,14 +12,14 @@ use Icinga\Module\Director\Objects\IcingaObject;
|
|||||||
use Icinga\Module\Director\Objects\IcingaZone;
|
use Icinga\Module\Director\Objects\IcingaZone;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
abstract class BaseTestCase extends TestCase
|
abstract class BaseTestCase extends \Icinga\Test\BaseTestCase
|
||||||
{
|
{
|
||||||
private static $app;
|
private static $app;
|
||||||
|
|
||||||
/** @var Db */
|
/** @var Db */
|
||||||
private static $db;
|
private static $db;
|
||||||
|
|
||||||
public function setUp(): void
|
public function ssetUp(): void
|
||||||
{
|
{
|
||||||
$this->app();
|
$this->app();
|
||||||
}
|
}
|
||||||
@ -81,11 +81,14 @@ abstract class BaseTestCase extends TestCase
|
|||||||
self::$db = new Db($dbConfig);
|
self::$db = new Db($dbConfig);
|
||||||
$migrations = new Migrations(self::$db);
|
$migrations = new Migrations(self::$db);
|
||||||
$migrations->applyPendingMigrations();
|
$migrations->applyPendingMigrations();
|
||||||
IcingaZone::create([
|
$zone = IcingaZone::create([
|
||||||
'object_name' => 'director-global',
|
'object_name' => 'director-global',
|
||||||
'object_type' => 'external_object',
|
'object_type' => 'external_object',
|
||||||
'is_global' => 'y'
|
'is_global' => 'y'
|
||||||
])->store(self::$db);
|
]);
|
||||||
|
if (! IcingaZone::exists($zone->getId(), self::$db)) {
|
||||||
|
$zone->store(self::$db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$db;
|
return self::$db;
|
||||||
|
@ -435,7 +435,7 @@ class IcingaHostTest extends BaseTestCase
|
|||||||
$msg = $e->getMessage();
|
$msg = $e->getMessage();
|
||||||
$matchMysql = strpos(
|
$matchMysql = strpos(
|
||||||
$msg,
|
$msg,
|
||||||
"Duplicate entry 'a' for key 'api_key'"
|
"Duplicate entry 'a' for key 'icinga_host.api_key'"
|
||||||
) !== false;
|
) !== false;
|
||||||
|
|
||||||
$matchPostgres = strpos(
|
$matchPostgres = strpos(
|
||||||
@ -747,7 +747,7 @@ class IcingaHostTest extends BaseTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$kill = array('___TEST___zone');
|
$kill = ['___TEST___zone', '___TEST___zone2'];
|
||||||
foreach ($kill as $name) {
|
foreach ($kill as $name) {
|
||||||
if (IcingaZone::exists($name, $db)) {
|
if (IcingaZone::exists($name, $db)) {
|
||||||
IcingaZone::load($name, $db)->delete();
|
IcingaZone::load($name, $db)->delete();
|
||||||
|
@ -44,6 +44,7 @@ class IcingaServiceTest extends BaseTestCase
|
|||||||
|
|
||||||
public function testAcceptsAssignRules()
|
public function testAcceptsAssignRules()
|
||||||
{
|
{
|
||||||
|
$this->expectNotToPerformAssertions();
|
||||||
$service = $this->service();
|
$service = $this->service();
|
||||||
$service->object_type = 'apply';
|
$service->object_type = 'apply';
|
||||||
$service->assign_filter = 'host.address="127.*"';
|
$service->assign_filter = 'host.address="127.*"';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user