Project

General

Profile

Actions

Bug #22430

closed

Plugin permissions are cleared on tests

Added by Daniel Lobato Garcia about 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Tests
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

The problem:

- Some tests are removing all plugins (plugin_test, rabl_test, belongs_to_proxy_test) from the registry. This has, among others, one important consequence: the plugin permissions are removed.
- Take an example. Foreman Ansible overrides the Host#form with a list of 'Ansible Roles' to choose.
- When the view for this Host#form is rendered (e.g: a HostController or HostJSTest), the list of 'Ansible Roles' has also to be rendered.
- Since a previous test removed the plugin from the `Foreman::Plugin.all` registry, but the plugin is still installed as a Rails Engine, the overrides by deface still apply.
- Some tests that render the Host form fail to run as rendering is impossible without the 'ansible_roles' permission. These permissions are only loaded in tests if the plugin is registered in Foreman::Plugin*

Foreman::Plugin::RbacRegistry should not be cleared https://github.com/theforeman/foreman/blob/develop/test/fixtures/permissions.yml#L772

To fix this, I suggest adding a helper method to our test_helper to handle removing & restoring.

Actions #1

Updated by The Foreman Bot about 6 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/5218 added
Actions #2

Updated by Ohad Levy about 6 years ago

  • translation missing: en.field_release set to 330
Actions #3

Updated by Anonymous about 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF