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

(maint) Update beaker to support pupppet5 style installation #18

Merged
merged 3 commits into from
Oct 13, 2017

Conversation

melissa
Copy link
Contributor

@melissa melissa commented Sep 22, 2017

No description provided.

@puppetlabs-jenkins
Copy link
Contributor

Can one of the admins verify this patch?

@melissa
Copy link
Contributor Author

melissa commented Sep 22, 2017

rspec tests are broken, but I still plan on updating the tests

@melissa melissa force-pushed the maint/master/update-new-repos-take-2 branch from e872003 to e07c7f9 Compare September 25, 2017 18:00
@melissa
Copy link
Contributor Author

melissa commented Sep 26, 2017

rspec tests are fixed and working, I'd just like to add a few new tests for the new code I've added

@melissa melissa requested review from kevpl and johnduarte September 26, 2017 20:58
@melissa
Copy link
Contributor Author

melissa commented Sep 26, 2017

These changes are only needed to access the public repos, users shouldn't have to do anything special yet to access the packages on builds.delivery.puppetlabs.net.

@mchllweeks
Copy link

@johnduarte Do you have time to also review this pr?

@melissa
Copy link
Contributor Author

melissa commented Oct 2, 2017

I'd still like to update the tests, I haven't had time to do that yet.

@melissa melissa force-pushed the maint/master/update-new-repos-take-2 branch from e07c7f9 to 6203444 Compare October 5, 2017 16:25

subject.install_puppet_agent_from_msi_on( host, opts.merge({:puppet_collection => 'puppet'}) )
expect(subject).to receive(:link_exists?).with("#{opts[:win_download_url]}/puppet/puppet-agent-VERSION-x64.msi").and_return( true )
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm having issues with these tests. How do I get it to not execute all the things? This is the error I get with the current iteration. If I move line 845 up after 841, it gets to the cygwin check, but it looks like I should just be able to only check the thing getting passed into :link_exists?, and end there. What am I missing?

  1) ClassMixedWithDSLInstallUtils#install_puppet_agent_from_msi_on returns the right link when puppet collection is set
     Failure/Error: raise "Puppet MSI at #{link} does not exist!"

     RuntimeError:
       Puppet MSI at http://downloads.puppetlabs.com/windows/puppet/puppet-agent-VERSION-x64.msi does not exist!
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:603:in `block in install_a_puppet_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:596:in `install_a_puppet_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:590:in `block in install_puppet_agent_from_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:576:in `install_puppet_agent_from_msi_on'
     # ./spec/beaker-puppet/install_utils/foss_utils_spec.rb:844:in `block (3 levels) in <top (required)>'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For example, I added in a second test in the other way I can think to do this below. Results are:

  1) ClassMixedWithDSLInstallUtils#install_puppet_agent_from_msi_on returns the right link when puppet collection is set
     Failure/Error: raise "Puppet MSI at #{link} does not exist!"

     RuntimeError:
       Puppet MSI at http://downloads.puppetlabs.com/windows/puppet/puppet-agent-VERSION-x64.msi does not exist!
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:603:in `block in install_a_puppet_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:596:in `install_a_puppet_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:590:in `block in install_puppet_agent_from_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:576:in `install_puppet_agent_from_msi_on'
     # ./spec/beaker-puppet/install_utils/foss_utils_spec.rb:844:in `block (3 levels) in <top (required)>'

  2) ClassMixedWithDSLInstallUtils#install_puppet_agent_from_msi_on returns the right link when puppet collection is not set
     Failure/Error: if host.is_cygwin?

     NoMethodError:
       undefined method `is_cygwin?' for #<Hash:0x007f40ba102668>
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:609:in `block in install_a_puppet_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:596:in `install_a_puppet_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:590:in `block in install_puppet_agent_from_msi_on'
     # ./lib/beaker-puppet/install_utils/foss_utils.rb:576:in `install_puppet_agent_from_msi_on'
     # ./spec/beaker-puppet/install_utils/foss_utils_spec.rb:853:in `block (3 levels) in <top (required)>'

Copy link
Contributor

Choose a reason for hiding this comment

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

@melissa it looks like the method :install_a_puppet_msi_on doesn't have any spec tests; if you wanted to continue adding tests from the method :install_puppet_agent_from_msi_on you would need to mock out the rest of the method.

I would suggest adding a new describe block that tests :install_a_puppet_msi_on, with your code that tests it removed to a new method that :install_a_puppet_msi_on calls. Maybe call it something like build_msi_path?

The code that I would move to that method is:

if opts[:puppet_collection] && opts[:puppet_collection].match(/puppet\d*/)
              link = "#{opts[:win_download_url]}/#{opts[:puppet_collection]}/#{host['dist']}.msi"
            else
              link = "#{opts[:win_download_url]}/#{host['dist']}.msi"
            end
            if not link_exists?( link )
              raise "Puppet MSI at #{link} does not exist!"
            end

@melissa melissa force-pushed the maint/master/update-new-repos-take-2 branch 4 times, most recently from 9cd8982 to 02580e0 Compare October 9, 2017 22:46
@melissa
Copy link
Contributor Author

melissa commented Oct 9, 2017

Tests have been updated, thank you @tvpartytonight !

@melissa melissa force-pushed the maint/master/update-new-repos-take-2 branch from 02580e0 to 1d37dd3 Compare October 9, 2017 22:53
@melissa
Copy link
Contributor Author

melissa commented Oct 10, 2017

@johnduarte @kevpl @tvpartytonight I'd love to get some eyes on this. It sounds like folks are ready to start using this code.

Copy link
Contributor

@johnduarte johnduarte left a comment

Choose a reason for hiding this comment

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

👍 This looks great.
Confirmed this does not inhibit installation on EC2 instances.

@melissa
Copy link
Contributor Author

melissa commented Oct 12, 2017

@kevpl @tvpartytonight any additional things that need to happen before this can be merged?

Copy link
Contributor

@kevpl kevpl left a comment

Choose a reason for hiding this comment

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

Everything seems in order here. We just need to get through the automated tests & give @tvpartytonight a last chance to approve of the last changes requested.

@tvpartytonight
Copy link
Contributor

👍

@tvpartytonight
Copy link
Contributor

@kevpl I don't see any jenkins bot testing comments...I assume I can just kick one off, for safety's sake?

@tvpartytonight
Copy link
Contributor

@puppetlabs-jenkins test this please

@melissa
Copy link
Contributor Author

melissa commented Oct 13, 2017

From what I can tell, there are no automated tests that get kicked off on beaker-puppet PRs

@kevpl
Copy link
Contributor

kevpl commented Oct 13, 2017

They ran when @tvpartytonight kicked them, but I don't think they put comments in the conversation anymore, just a status on the commit itself.

@kevpl kevpl merged commit a855926 into puppetlabs:master Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants