Run permissions tests from Foreman core#51
Conversation
|
I wish this list (or at least its base) could come from Foreman and not be hard-coded here. |
How do you know what is and isn't relevant from Foreman core? Today in Jenkins we run the full Foreman test suite, which makes it a lot slower but you'd test for regressions. |
a91eb4d to
cf5edfa
Compare
I don't think there is a way to "know", but we can offer a "recommended minimum"? |
|
OpenSCAP has defined a specific task for it: Now one question is: should |
I think a static list is perfectly fine. |
|
Just a crazy idea: how about some helper in Foreman itself to define the test tasks? Then allow further configuration via a block. |
|
Crazy? Maybe. IMHO one thing we should consider is time. Is this something we want to have soon or we can live without while we figure out the best implementation? |
| t.libs << test_dir | ||
| t.pattern = "#{test_dir}/**/*_test.rb" | ||
| Rake::TestTask.new(:foreman_plugin_template => 'db:test:prepare') do |t| | ||
| t.libs << ForemanPluginTemplate::Engine.root.join('test') |
There was a problem hiding this comment.
Before this, libs was ['test', File.expand_path('../../test', __dir__)], now it's only [ForemanPluginTemplate::Engine.root.join('test')], doesn't that mean the bare test one is not added anymore, which means the test helpers from Foreman are not available anymor?
There was a problem hiding this comment.
We just tried that and this is exactly what happened: https://github.com/ATIX-AG/foreman_resource_quota/actions/runs/12009329940/job/33473856106#step:21:18
| Rake::TestTask.new(:foreman_plugin_template => 'db:test:prepare') do |t| | ||
| t.libs << ForemanPluginTemplate::Engine.root.join('test') | ||
| t.pattern = ForemanPluginTemplate::Engine.root.join('test', '**', '*_test.rb') | ||
| t.test_files = [Rails.root.join('test/unit/foreman/access_permissions_test.rb')] |
There was a problem hiding this comment.
IMHO this is the important line of this PR and we should get that merged.
There was a problem hiding this comment.
I also think that this should get merged because we just stumbled across some permissions issue during plugin development and I realized only now that this permissions test got lost during the move to the unified github actions workflow.
Opened to showcase an alternative to theforeman/actions#16.
The idea is that plugins should always run a certain test from core. This relies on:
It also starts to depend on
db:test:preparesince I saw that at least inforeman_tasks.