-
Notifications
You must be signed in to change notification settings - Fork 16
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
Expose multi-CV feature downstream #85
Expose multi-CV feature downstream #85
Conversation
Stubbing constants is weird (in Ruby?). You'd need |
Originally I was just setting them in the test, but that felt weird too. What's the non-weird way? |
I think it would be better to redesign the class UpstreamOnlySettings
def self.include?(key)
new.include?
def include?(key)
SETTINGS.include?(key.to_s)
end
end Then it would be easier to stub the class: UpstreamOnlySettings.any_instance.stubs(:include?).returns(false) |
0ed46ea
to
d029292
Compare
@ShimShtein good idea! updated. I'm relying on CI to see if my tests are good, looks like someone needs to click a button for me |
@ShimShtein how's it looking now? |
4176408
to
83df9a5
Compare
guess I was trying to be a Pythonista... updated |
83df9a5
to
5a0e475
Compare
LGTM. Let's wait for the tests |
I can't run tests locally, I am getting errors like
I'm guessing it's Zeitwerk-related somehow?... |
@jeremylenz Currently I see only unmet expectations failures in the report: https://github.com/RedHatSatellite/foreman_theme_satellite/actions/runs/11223216416/job/31283723243?pr=85#step:21:36 Do you see something else? |
that's what I see too. |
5a0e475
to
82e750c
Compare
I was finally able to update my dev box and see why the tests were failing. Should be passing now. |
🍏 |
UpstreamOnlySettings.expects(:include?).with('test_setting').returns(true) | ||
assert_nil Setting['test_setting'] |
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.
You never add test_setting
to UpstreamOnlySettings::SETTINGS
, so this test is not testing what it says to be testing.
Wouldn't you need to first declare that setting with a default value, then add it to UpstreamOnlySettings and then assert the result is nil
?
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.
I can't
UpstreamOnlySettings::SETTINGS << 'test_setting'
due to
FrozenError: can't modify frozen Array: []
But I did add the setting definition in the test.
(and did confirm it does fail when I comment out the
UpstreamOnlySettings.expects(:include?).with('test_setting').returns(true)
)
does that look okay?
82e750c
to
1e34872
Compare
Side note: I went thru some confusing test failures because Minitest is retrying the test. The retries aren't the actual failure:
I can't find where the retries are configured 🤔 |
1e34872
to
e6a3ee5
Compare
@evgeni how's it look now? |
Setting['allow_multiple_content_views'] | ||
UpstreamOnlySettings.expects(:include?).with('test_setting').returns(true) | ||
Rails.logger.expects(:debug).with('Setting \'test_setting\' is not available in Satellite; ignoring') | ||
Setting['test_setting'] |
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.
You are not defining the test_setting
in settings here. Are you relying on the test execution order?
Also not related to this specific PR: why do we have two classes in a single file? Can we separate them please?
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.
I think this relies on the fact that Setting[something]
always queries the Settings registry and triggers the warning code, even if the setting is not actually defined. (The test worked also before the setting definition in the previous test that I asked for)
Merged. Thanks @jeremylenz ! |
This removes
allow_multiple_content_views
from UpstreamOnlySettings, allowing it to be exposed downstream.I didn't remove the UpstreamOnlySettings feature entirely, because I thought it might be handy to have in the future? thoughts welcome.