-
Notifications
You must be signed in to change notification settings - Fork 217
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
Fixes #33356 - APP_ROOT defined for tests #797
Conversation
Context: theforeman/smart_proxy_openscap#86 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't rush this. I've noticed that a lot of plugins are starting to build their own constants for this. In particular, I want to introduce something that in production should point to /var/lib/foreman-proxy
. It looks like OpenSCAP needs that, but there are many others. Let's think about that properly.
0a6ed54
to
49a46e5
Compare
Rebased, I cannot wait with this, I am unable to continue on OpenSCAP refactoring due to this. I fully support resolving the common storage problem, but it has nothing to do with this - this constant is simply not available when we load plugins from unit tests without loading full smart proxy main stack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's start with the background. The APP_ROOT
is defined here:
smart-proxy/lib/smart_proxy_main.rb
Line 1 in d9b0502
APP_ROOT = "#{__dir__}/.." |
This is an issue because you have smart_proxy_openscap in your bundle.
For testing, we have an alternative to smart_proxy_main, namely smart_proxy_for_testing. I wonder if that would be the correct place because it would then also be present in modules that don't use the test_helper here but define their own. However, then the root would be the Smart Proxy root, not the plugin root itself.
For reference:
https://github.com/theforeman/smart_proxy_openscap/blob/1af66df4083c5968f4e6489fed7fb6e4f7eb6c21/test/test_helper.rb#L9-L13
Overall I'd say this isn't so urgent because it only happens if smart_proxy_openscap is in your bundle.
49a46e5
to
9c09003
Compare
I moved this into
In other words, you don't care about me needing to comment out OpenSCAP plugin everytime I work on smart-proxy core PR. Well, how cool is that. |
There are other considerations, like what it means. So putting it in
There's other workarounds. For example, use this in your unless ENV['SKIP_OPENSCAP']
gem ...
end Then in your shell you can |
Can you just re-review the current version? There is nothing wrong with this proposal, APP_ROOT is smart proxy application root being defined in a testing ruby helper file. |
9c09003
to
6448740
Compare
Ok, how about this - I created DATA_DIR constant and an empty directory in git named
|
OpenSCAP plugin class requires this to be defined, tests do fail when openscap plugin is enabled.