RFC: Including selected tests from Foreman core during plugin test execution
Decision Due Date: 2026-07-13
Context and Problem Statement
Foreman plugins today utilize the shared action from theforeman/actions to run tests. The main suite that gets executed there is rake test:$plugin_name which the plugin can define itself in its lib/tasks/$plugin_name.rake file, which in most cases is a "run all tests you can find in the test/ directory.
However, it can be beneficial to also run tests from Foreman core (e.g. access_permissions_test.rb).
We used to do this when we used Jenkins, but stopped with the migration to GHA.
Proposal
The “simplest” way to achieve this is to add the additional tests to theforeman/actions, e.g. as done in Run a predefined set of tests from core to ensure integration by evgeni · Pull Request #91 · theforeman/actions · GitHub
This has the downside that the definition which tests from core are valuable now lives inside the action and can’t be (easily) altered by neither Foreman core nor the plugins.
Alternative Designs
Explicitly adding the test into test:$plugin_name
This was proposed in Run permissions tests from Foreman core by ekohl · Pull Request #51 · theforeman/foreman_plugin_template · GitHub and some plugins do this already:
foreman_ansible/lib/tasks/foreman_ansible_tasks.rake at cba9c398aca724d467888cce93f2524e16952413 · theforeman/foreman_ansible · GitHub
However, this means that every plugin needs to opt-in to this method and while the original proposal by @ekohl is about 3 years old now, not many plugins have done so.
Extending test:$plugin_name from Foreman core
We could extend Foreman’s test.rake to have a dedicated target for “tests useful for plugins” and automatically add a dependency on this target to all Rake tasks that match test:foreman_ (that’s the only way to identify plugin tasks, sorry Katello and foreman-tasks).
The dependency injection seems hacky though ![]()
Providing test:core_tests and letting the action call it.
Same as the “Extending” proposal above, but instead of injecting the dependency, we rely on the action to call it.
As the action is used by older Foreman releases too, this seems risky, as it would mean that we also need to backport test:core_tests to older releases.
Decision Outcome
Providing test:core_tests and letting the action call it. Fallback to rake test TEST="test/unit/foreman/access_permissions_test.rb" for Foreman versions that do not have that rake task. Plugins can opt-out.
Impacts
This should impact all plugins, by running a set of recommended tests from core during plugin testing.
The plugins that already do this themselves need to adjust (but running the tests twice is not really a problem either).