Fix zone creation and deletion for tests

This commit is contained in:
raviks789 2024-01-16 13:21:27 +01:00
parent 58e2a8fca6
commit 0ea0a8fd83
2 changed files with 6 additions and 3 deletions

View File

@ -76,11 +76,14 @@ abstract class BaseTestCase extends IcingaBaseTestCase
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;

View File

@ -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();