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/AUT-3711/hide-delivery-test-runner-features #488

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

shaveko
Copy link
Contributor

@shaveko shaveko commented Jun 24, 2024

related to https://oat-sa.atlassian.net/browse/AUT-3711

Description

Test Runner Features needs to be removed from the list of Delivery props.

How to test

Deployed to test-rfe-1147-facelift kitchen env

The Test Runner Features is empty and not displayed on bare installation of tao.

So you need to add it first

  • add following file to tao/scripts/install
    SetupSecuritySettingsFeature.php
<?php
/** Copyright (c) 2020 (original work) Open Assessment Technologies SA; */

declare(strict_types=1);

namespace oat\tao\scripts\install;

use common_report_Report as Report;
use oat\oatbox\extension\InstallAction;
use oat\taoTestRunnerPlugins\scripts\tools\PluginManager;
use oat\taoTests\models\runner\features\ManageableFeature;
use oat\taoTests\models\runner\plugins\TestPlugin;
use oat\taoTests\models\runner\plugins\TestPluginService;

class SetupSecuritySettingsFeature extends InstallAction
{
    public function __invoke($params = [])
    {
        /** @var TestPluginService $testPluginService */
        $testPluginService = $this->getServiceLocator()->get(TestPluginService::SERVICE_ID);

        $plugins = array_filter($testPluginService->getAllPlugins(), static function (TestPlugin $plugin) {
            return $plugin->getCategory() === 'security'
                && $plugin->isActive();
        });

        $this->addFeature('security', 'Security Settings', $plugins);

        return new Report(Report::TYPE_SUCCESS, count($plugins) .  ' plugins in Security Setting feature registered.');
    }

    private function addFeature(string $id, string $name, array $plugins): void
    {
        $pluginsIds = array_values(array_map(static function (TestPlugin $plugin) {
            return $plugin->getId();
        }, $plugins));

        $pluginManager = new PluginManager();
        $this->propagate($pluginManager);

        $pluginManager([
            '--addFeature',
            '--featureOptions', json_encode([
               ManageableFeature::OPTION_ID => $id,
               ManageableFeature::OPTION_DESCRIPTION => $name,
               ManageableFeature::OPTION_LABEL => $name,
               ManageableFeature::OPTION_ACTIVE => true,
               ManageableFeature::OPTION_ENABLED_BY_DEFAULT => true,
               ManageableFeature::OPTION_PLUGIN_IDS => $pluginsIds,
            ])
        ]);
    }
}
  • run php index.php "oat\tao\scripts\install\SetupSecuritySettingsFeature" from inside tao container
  • publish some delivery and check its props
  • in Simple Mode there should be no Test Runner Features
  • in Advanced mode it should be present

Copy link

github-actions bot commented Jun 24, 2024

Front-end summary Node 18

💯 Total ✅ Passed ⏭️ Skipped ❌ Failed
13 13 0 0

Copy link

Version

Target Version 14.22.1
Last version 14.22.0

There are 0 BREAKING CHANGE, 0 feature, 1 fix

@shaveko shaveko changed the title fix: hide test runner features fix/AUT-3711/hide-delivery-test-runner-features Jun 25, 2024
Copy link
Contributor

@gabrielfs7 gabrielfs7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

@shaveko shaveko merged commit be4f1e2 into develop Jun 27, 2024
5 checks passed
@shaveko shaveko deleted the fix/AUT-3711/hide-delivery-test-runner-features branch June 27, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants