Skip to content

Commit

Permalink
MigrateCommandTest: Add mysterious case
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Mar 21, 2024
1 parent c2e977b commit 1e7152b
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions test/php/application/clicommands/MigrateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,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',
Expand All @@ -326,7 +326,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',
Expand Down Expand Up @@ -960,6 +960,29 @@ public function testNavigationMigrationTransformsAlreadyExistingIcingaDBActions(
$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
Expand Down

0 comments on commit 1e7152b

Please sign in to comment.