This commit is contained in:
Johannes Meyer 2026-05-24 04:23:35 +08:00 committed by GitHub
commit a3f402f650
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -307,7 +307,7 @@ class MigrateCommandTest extends TestCase
'filter' => 'host_name=%2Afoo%2A',
'owner' => 'test'
],
'hosts_encoded_params' => [
'shared-hosts_encoded_params' => [
'type' => 'host-action',
'url' => 'monitoring/list/hosts?host_name=%28foo%29&sort=_host_%28foo%29',
'filter' => '_host_%28foo%29=bar',
@ -327,7 +327,7 @@ class MigrateCommandTest extends TestCase
'filter' => 'host.name~%2Afoo%2A',
'owner' => 'test'
],
'hosts_encoded_params' => [
'shared-hosts_encoded_params' => [
'type' => 'icingadb-host-action',
'url' => 'icingadb/hosts?host.name=%28foo%29&sort=host.vars.%28foo%29',
'filter' => 'host.vars.%28foo%29=bar',
@ -961,6 +961,29 @@ class MigrateCommandTest extends TestCase
$this->assertSame($services, $servicesAfterSecondRun);
}
/**
* Checks the following:
* - Whether existing Icinga DB Actions are transformed regarding wildcard filters
*/
public function testTest()
{
[$legacyHostActions, $expectedMigrated] = $this->getConfig('host-actions');
$this->createConfig('navigation/host-actions.ini', $legacyHostActions);
$this->createConfig('preferences/test/icingadb-host-actions.ini', $expectedMigrated);
$command = $this->createCommandInstance('--user', 'test');
$command->navigationAction();
$legacyConfig = $this->loadConfig('navigation/host-actions.ini');
$shouldBeEmpty = $this->loadConfig('navigation/icingadb-host-actions.ini');
$expectedConfig = $this->loadConfig('preferences/test/icingadb-host-actions.ini');
$this->assertSame($legacyHostActions, $legacyConfig);
$this->assertSame($expectedMigrated, $expectedConfig);
$this->assertEmpty($shouldBeEmpty);
}
/**
* Checks the following:
* - Whether legacy host/service macros are migrated