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