Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a mysterious MigrateCommand issue #992

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading