Bug #20274

Filter fixtures for plugins are created with many resource_types

Added by Daniel Lobato Garcia 3 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Daniel Lobato Garcia
Category:Tests
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4657
Story points-
Velocity based estimate-
Release1.15.3Release relationshipAuto

Description

Filters cannot have many resource_types - each filter needs to have its own resource type, e.g: one filter does not accommodate permissions for "Host" and "DiscoveredHost".
This is enforced by a validator in the model, but our fixtures are able to completely skip it. The result is that plugins have Filters with multiple resource types. This has not been a problem until recently, as we added a test that checks that the db filter cache can be recreated (CacheManagerTest). On plugins, this test fails to pass as fixtures are wrongly created.

Associated revisions

Revision be92dc95
Added by Daniel Lobato Garcia 3 months ago

Fixes #20274 - Filter fixtures have many resource_types

Filters cannot have many resource_types - each filter needs to have its
own resource type, e.g: one filter does not accommodate permissions for
"Host" and "DiscoveredHost".

This is enforced by a validator in the model, but our fixtures are able
to completely skip it. The result is that plugins have Filters with
multiple resource types.

This has not been a problem until recently, as we added a test that
checks that the db filter cache can be recreated (CacheManagerTest).
On plugins, this test fails to pass as fixtures are
wrongly created.

To reproduce, make sure your test DB is either Postgres or MySQL, add a
plugin (like foreman_discovery), and try to run the CacheManagerTest

Revision 536e1298
Added by Daniel Lobato Garcia 2 months ago

Fixes #20274 - Filter fixtures have many resource_types

Filters cannot have many resource_types - each filter needs to have its
own resource type, e.g: one filter does not accommodate permissions for
"Host" and "DiscoveredHost".

This is enforced by a validator in the model, but our fixtures are able
to completely skip it. The result is that plugins have Filters with
multiple resource types.

This has not been a problem until recently, as we added a test that
checks that the db filter cache can be recreated (CacheManagerTest).
On plugins, this test fails to pass as fixtures are
wrongly created.

To reproduce, make sure your test DB is either Postgres or MySQL, add a
plugin (like foreman_discovery), and try to run the CacheManagerTest

(cherry picked from commit be92dc95928c289a76bab84c3b03862a29a480db)

History

#1 Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman/pull/4657 added

#2 Updated by Daniel Lobato Garcia 3 months ago

  • Release set to 1.15.3

#3 Updated by Anonymous 3 months ago

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

Also available in: Atom PDF