Skip to content
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

Fix Settings issue where Arrays would merge instead of overwrite #7670

Merged
merged 1 commit into from
Apr 5, 2016

Conversation

Fryguy
Copy link
Member

@Fryguy Fryguy commented Apr 1, 2016

The ability to override Arrays has been made into a PR upstream at
rubyconfig/config#137 and
danielsdeleo/deep_merge#21 . However, they
are not yet merged. When they are merged and released, we can
switch back to a released version.

Supercedes #7656
Paired on this with @carbonin

@jrafanie Please review.

The ability to override Arrays has been made into a PR upstream at
rubyconfig/config#137 and
danielsdeleo/deep_merge#21 . However, they
are not yet merged.  When they are merged and released, we can
switch back to a released version.

Supercedes ManageIQ#7656
Paired on this with @carbonin
@miq-bot
Copy link
Member

miq-bot commented Apr 1, 2016

Checked commit Fryguy@5e0215c with ruby 2.2.3, rubocop 0.37.2, and haml-lint 0.16.1
3 files checked, 2 offenses detected

Gemfile

@miq-bot
Copy link
Member

miq-bot commented Apr 1, 2016

<github_pr_commenter_batch />Some comments on commit Fryguy@5e0215c

end

it "with database changes on an Array" do
server.settings_changes.create!(:key => "/log/collection/current/pattern", :value => ["*.log"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this correctly, these tests are testing this change only if the settings.yml originally has an array in /log/collection/current/pattern. Does it make sense to not depend on the current values in the settings.yml by injecting a desired value for it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, I ask this because I didn't originally realize what this PR was doing since I couldn't see that the existing value was an array we want to replace instead of merge.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree injecting a value would be better, but I'm not sure how to do that. I think we would have to add an additional config source for specs. @Fryguy ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try. 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, stubbing settings is an incredible pain in the neck, particularly because we build new Settings constants on the fly when things change. I have a helper method that stubs the Settings const as well as for_resource, but then that, of course, bypasses all the database stuff, which these methods are trying to test directly

Basically, I'm not really sure how to test the Settings machinery by stubbing the Settings machinery 😝

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can change the the example's description in a followup PR, something like "with database changes for an Array field from a template source"

@jrafanie
Copy link
Member

jrafanie commented Apr 4, 2016

Looks good @Fryguy @carbonin, I had minor questions more than anything else.

@chessbyte chessbyte merged commit ba1813a into ManageIQ:master Apr 5, 2016
@chessbyte chessbyte added this to the Sprint 39 Ending Apr 18, 2016 milestone Apr 5, 2016
@Fryguy Fryguy deleted the overwrite_arrays branch April 5, 2016 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants