-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
(PUP-7309) acceptance: hiera merge strategies #5692
(PUP-7309) acceptance: hiera merge strategies #5692
Conversation
|
||
teardown do | ||
step "remove global hiera.yaml" do | ||
on(master, "rm #{confdir}/hiera.yaml") |
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.
The global hiera.yaml is installed by packages, so we shouldn't remove it, and the test should use a temp hiera.yaml instead (or backup/restore).
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.
oh right. thanks. i'll backup/restore
test hiera3 and hiera5 merge strategies using hiera_hash and lookup functions
* this covers a regression reported in PUP-7286 * ensure hiera_xxx uses merge behavior from hiera config * ensure lookup uses merge behavior per-lookup, or per key
60ddc69
to
4f88e08
Compare
SITE | ||
|
||
on(master, "chmod -R 775 #{fq_tmp_environmentpath}") | ||
on(master, "chmod -R 775 #{master_confdir}") |
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.
Is changing the permissions on the real confdir
going to affect/break later tests that run puppet apply/agent
and assume there are no changes? Do we just need to make the newly generated hiera.yaml
ownable by puppet:puppet
?
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.
yeah, sloppy. i'll be more restrictive
|
||
teardown do | ||
step "restore default global hiera.yaml" do | ||
on(master, "mv #{hiera_conf_backup} #{master_confdir}/hiera.yaml") |
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.
This teardown step should ensure that the hiera_conf_backup
file is present beforehand. If the backup step below should fail to create the backup file, then the teardown will erroneously fail.
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.
😐 meh
i'm not clear why that's important. in particular because i stole this from your test O:)
although you have acceptable exit codes of 0 and 1
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.
That's one reason why I slightly prefer generating temp files and pointing the test to the temp file. Less to worry about when cleaning up, and less likely to break test that follow.
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.
yeah, but you can't do that here without reloading/restarting the server. i'm trying to avoid that in our tests so we can later remove #with_puppet_running_on
.
i agree it's a tradeoff and we should probably make a decision on if you can touch the default install/config. we might even make it difficult to do, in the tooling or on the SUT in the pre-suite steps.
we should do some profiling with the proposed beaker profiler
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 admire the direction, but I'm not sure that skipping restart (at least HUP) is safe, due to caching in hiera and/or the compiler. So I'm ok to merge this PR, but something to think about before removing with_puppet_running_on
.
- array1: | ||
key1: val1 | ||
key2: val2 | ||
YAML |
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.
nitpick, this is the only indented heredoc terminator in this PR
|
||
with_puppet_running_on(master,{}) do | ||
agents.each do |agent| | ||
step "agent lookups #{agent.hostname}, hiera3" do |
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.
Would this test be more readable and maintainable if it was split into two tests, one for v3 and one for v5?
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 believe the opposite. putting it in one place makes it more discoverable, readable and maintainable, IMO
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.
it's just on the verge of being too long 🦈
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.
the one argument i'm thinking of for splitting it in two is that it could be easier to remove the v3 testing when it comes time. but this is still very easy in this test, and extremely difficult in other tests like lookup/lookup.rb :-\
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 do not merge until after PA 1.9.3 ships. |
@er0ck could you verify this test works when there is an agent on the master? |
...
|
test hiera3 and hiera5 merge strategies using hiera_hash and lookup
functions
edit: added a commit for hiera_array and merge_hash_arrays