Skip to content

(PUP-10527) Test puppet service runs puppet#8185

Merged
gimmyxd merged 2 commits intopuppetlabs:masterfrom
johnduarte:issues/master/pup-10527/acceptance-test-puppet-service-runs-puppet
Jun 18, 2020
Merged

(PUP-10527) Test puppet service runs puppet#8185
gimmyxd merged 2 commits intopuppetlabs:masterfrom
johnduarte:issues/master/pup-10527/acceptance-test-puppet-service-runs-puppet

Conversation

@johnduarte
Copy link
Contributor

This commit adds an acceptance test to ensure that starting the puppet
service on agents runs puppet. This validation was missing from the
puppet_service_management.rb test. Due to the comprehensive nature of
the existing test, this test is added independently to reduce execution
time. The existing test takes about 4m to execute while this specific
case takes about 30s.

@johnduarte johnduarte requested review from a team June 2, 2020 20:56
@johnduarte
Copy link
Contributor Author

johnduarte commented Jun 2, 2020

This test has been locally validated on el-7 and windows-2012 to:

@johnduarte
Copy link
Contributor Author

I am not sure what is going on with the windows spec test failure in appveyor. 🤷

@johnduarte johnduarte force-pushed the issues/master/pup-10527/acceptance-test-puppet-service-runs-puppet branch from ad2f344 to c6f2d1c Compare June 2, 2020 22:03
@puppetcla
Copy link

CLA signed by all contributors.

This commit adds an acceptance test to ensure that starting the puppet
service on agents runs puppet.  This validation was missing from the
`puppet_service_management.rb` test.  Due to the comprehensive nature of
the existing test, this test is added independently to reduce execution
time.  The existing test takes about 4m to execute while this specific
case takes about 30s.
@johnduarte johnduarte force-pushed the issues/master/pup-10527/acceptance-test-puppet-service-runs-puppet branch from c6f2d1c to f45bd98 Compare June 3, 2020 18:07
@GabrielNagy
Copy link
Contributor

For me this fails if the agent didn't run before on the target machine, since the last_run_report file was never there. We should also take this into account.

Maybe an easier way would be to remove the file when starting the test, and after the puppet run to check if it's present. Then we wouldn't need to compare times and whatnot.

Failing output:

Begin tests/resource/service/puppet_service_runs_puppet.rb

Starting the puppet service should successfully run puppet
  
  * Ensure stop puppet service
    
    playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) 17:31:50$ cmd.exe /c puppet resource service puppet ensure=stopped
      Warning: Skipping ip method to ssh to host as its value is not set. Refer to https://github.com/puppetlabs/beaker/tree/master/docs/how_to/ssh_connection_preference.md to remove this warning
      Attempting ssh connection to playable-girth.delivery.puppetlabs.net, user: Administrator, opts: {:config=>false, :verify_host_key=>false, :auth_methods=>["publickey"], :port=>22, :forward_agent=>true, :keys=>["id_rsa_acceptance", "~/.ssh/id_rsa-acceptance"], :user_known_hosts_file=>"/home/gabi/.ssh/known_hosts", :keepalive=>true}
verify_host_key: false is deprecated, use :never
      service { 'puppet':
        ensure   => 'stopped',
        provider => 'windows',
      }
    
    playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) executed in 5.72 seconds
    
    playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) 17:31:55$ cmd.exe /c puppet resource service puppet
      service { 'puppet':
        ensure   => 'stopped',
        enable   => 'manual',
        provider => 'windows',
      }
    
    playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) executed in 3.13 seconds
  
  playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) 17:31:58$ cmd.exe /c puppet config print statedir
    C:/ProgramData/PuppetLabs/puppet/cache/state
  
  playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) executed in 2.50 seconds
  
  playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) 17:32:01$ env PATH=":${PATH}" ruby -e 'puts File.stat("C:/ProgramData/PuppetLabs/puppet/cache/state/last_run_report.yaml").mtime.to_i'
    -e:1:in `stat': No such file or directory @ rb_file_s_stat - C:/ProgramData/PuppetLabs/puppet/cache/state/last_run_report.yaml (Errno::ENOENT)
    	from -e:1:in `<main>'
  
  playable-girth.delivery.puppetlabs.net (playable-girth.delivery.puppetlabs.net) executed in 0.75 seconds
  Exited: 1

@shrug shrug requested a review from a team June 15, 2020 17:46
@GabrielNagy GabrielNagy force-pushed the issues/master/pup-10527/acceptance-test-puppet-service-runs-puppet branch from d3fe7de to 6c69614 Compare June 16, 2020 12:17
@GabrielNagy GabrielNagy force-pushed the issues/master/pup-10527/acceptance-test-puppet-service-runs-puppet branch from 6c69614 to 4f55be1 Compare June 16, 2020 12:53
@GabrielNagy
Copy link
Contributor

jenkins please test this on redhat7-64,ubuntu1804-64,windows2016-64

@puppetcla
Copy link

CLA signed by all contributors.

@gimmyxd gimmyxd merged commit bd20734 into puppetlabs:master Jun 18, 2020
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.

5 participants