-
Notifications
You must be signed in to change notification settings - Fork 66
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
PE-24898 Set puppet collection value associated with agent version #60
PE-24898 Set puppet collection value associated with agent version #60
Conversation
Can one of the admins verify this patch? |
@jpartlow Here is the change I tried and installation passed with legacy_agent versions 2018.1.3%3A5.5.4 and 2018.1.2%3A5.5.2 |
@@ -72,6 +72,20 @@ def remove_puppet_paths_on(hosts) | |||
end | |||
end | |||
|
|||
#Given an agent_version, return the puppet collection associated with that agent version | |||
#@param [String] agent_version version string or 'latest' | |||
def get_puppet_collection(agent_version = 'latest') |
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 add a spec to puppet_utils_spec.rb testing get_puppet_collection().
It looks like this would return PC1 for 'latest', but I'm not sure why? Oh I see, opts[:puppet_agent_version] defaults to 'latest'. That does preserve the previous behavior...well, actually they weren't connected before, so I guess we need to decide what 'latest' would mean, and to mean that would mean latest collection?
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 right, I was just preserving the old behavior here. Going through the file, it looks like the default collection value is set to PC1 everywhere. I was under the impression that 'latest' will correspond to latest collection which is PC1 now. The latest collection needs to be updated as we move to the next collection.
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 will update the spec test
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.
'latest' would be puppet6 at this point. PC1 was the original collection, then puppet5, and puppet6 is tracking the future release of puppet6.
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.
Aha, 'latest' has a different meaning in that context then :) I took the word for its meaning.
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.
Oldest?
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.
hmm..but the get_puppet_collection() is called with value 'latest', not 'oldest' from install_puppet_agent_pe_promoted_repo_on ?
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.
Sorry, I was trying to figure out if you were taking 'latest' to mean 'oldest', but maybe we're talking about different things.
@@ -1293,7 +1293,7 @@ def install_puppet_agent_pe_promoted_repo_on( hosts, opts ) | |||
opts[:download_url] = "#{opts[:pe_promoted_builds_url]}/puppet-agent/#{ pe_ver }/#{ opts[:puppet_agent_version] }/repos" | |||
opts[:copy_base_local] ||= File.join('tmp', 'repo_configs') | |||
opts[:copy_dir_external] ||= host.external_copy_base | |||
opts[:puppet_collection] ||= 'PC1' | |||
opts[:puppet_collection] ||= get_puppet_collection(opts[:puppet_agent_version]) |
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 it straight forward to add a foss_utils_spec.rb that verifies paths for different puppet_agent_versions?
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 haven't looked at the spec test yet. Let me see if I can add that
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.
There is no spec test for install_puppet_agent_pe_promoted_repo_on() in foss_utils.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.
@jpartlow Updated the PR to include a test for verifying the path
de331bf
to
620bd36
Compare
allow( subject ).to receive( :options ).and_return( opts ) | ||
allow( subject ).to receive( :scp_to ) | ||
allow( subject ).to receive( :configure_type_defaults_on ).with(host) | ||
expect( subject ).to receive( :get_puppet_collection).with('agentversion').and_return(collection) |
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.
Beaker is horrible to unit test, since the method is all side effects, but it shouldn't be necessary to mock get_puppet_collection(), that's part of what we are testing after all, and it's just a function.
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.
Yes. Everything after .with('agentversion')
should be dropped if possible.
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.
Hmm, that would cause nothing to be returned from get_puppet_collection. I was suggesting that it not be mocked it at all.
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 my mistake, I thought that spec was for the correct invocation of method #get_puppet_collection
, not for the whole calling method. This does seem to be a lot of mocking for the method under consideration.
620bd36
to
3801bdb
Compare
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.
Coverage of all codepaths and specificity of mocks. 👍
@shaigy have you verified that this patch fixes the legacy agent tests? (I think that's what this was for?) |
Yes, this is to resolve the legacy agent installation failures here I validated the changes in beaker 3.0 since we haven't sorted out the dependency issues yet with beaker 4.0 in pe_accceptance_test suite. $ LEGACY_AGENT_VERSION=2018.1.3%3A5.5.4 bundle exec beaker -h ../legacy-agent.cfg --pre-suite setup/install.rb --helper lib/beaker_helper.rb
$ LEGACY_AGENT_VERSION=2018.1.3%3A5.5.3 bundle exec beaker -h ../legacy-agent.cfg --pre-suite setup/install.rb --helper lib/beaker_helper.rb
Since we move to frictionless agent install in CI I think this is the only job that will use this method of installation. |
3801bdb
to
8b56710
Compare
Legacy agent installation job testing older agents with new PE versions in Integration CI does not use frictionless installation method. Instead it downloads the agent package from pm.puppetlabs.com. Agent installation in that case fails since the puppet_collection value is set to default 'PC1' instead of 'puppet5' causing the construction of wrong 'onhost_copied_file' path. Added a method to return the correct puppet_collection depending on the agent version and use that value instead of the default
8b56710
to
110bb6b
Compare
Jenkins, retest this please. |
1 similar comment
Jenkins, retest this 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.
LGTM
@Dakta Got a +1 from Chris. Let me know if anything else is needed. |
Legacy agent installation job testing older agents with new PE versions
in Integration CI does not use frictionless installation method. Instead
it downloads the agent package from pm.puppetlabs.com. Agent
installation in that case fails since the puppet_collection value is set
to default 'PC1' instead of 'puppet5' causing the construction of wrong
'onhost_copied_file' path. Added a method to return the correct
puppet_collection depending on the agent version and use that value
instead of the default