diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 4ba1d9ea1..1495c3ae3 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -2,13 +2,13 @@ describe 'puppet_agent class' do - context 'default parameters' do + context 'default parameters in apply' do before(:all) { setup_puppet_on default } after (:all) { teardown_puppet_on default } it 'should work idempotently with no errors' do pp = <<-EOS - class { 'puppet_agent': } + class { 'puppet_agent': package_version => '1.10.0' } EOS # Run it twice and test for idempotency @@ -44,7 +44,6 @@ class { 'puppet_agent': } describe file(puppet_conf(default)) do it { is_expected.to exist } its(:content) { - is_expected.to match /cfacter[ ]*=[ ]*true/ is_expected.to_not match /stringify_facts[ ]*=[ ]*false/ is_expected.to_not match /parser[ ]*=[ ]*future/ } @@ -128,7 +127,8 @@ class { 'puppet_agent': service_names => [] } context 'agent run' do before(:all) { setup_puppet_on default, :agent => true - pp = "file { '#{master.puppet['codedir']}/environments/production/manifests/site.pp': ensure => file, content => 'class { \"puppet_agent\": service_names => [\"mcollective\"] }' }" + manifest = 'class { "puppet_agent": package_version => "1.10.0", service_names => ["mcollective"] }' + pp = "file { '#{master.puppet['codedir']}/environments/production/manifests/site.pp': ensure => file, content => '#{manifest}' }" apply_manifest_on(master, pp, :catch_failures => true) } after (:all) { @@ -167,7 +167,8 @@ class { 'puppet_agent': service_names => [] } context 'with mcollective configured' do before(:all) { setup_puppet_on default, :mcollective => true, :agent => true - pp = "file { '#{master.puppet['codedir']}/environments/production/manifests/site.pp': ensure => file, content => 'class { \"puppet_agent\": service_names => [\"mcollective\"] }' }" + manifest = 'class { "puppet_agent": package_version => "1.10.0", service_names => ["mcollective"] }' + pp = "file { '#{master.puppet['codedir']}/environments/production/manifests/site.pp': ensure => file, content => '#{manifest}' }" apply_manifest_on(master, pp, :catch_failures => true) } after (:all) { @@ -210,25 +211,6 @@ class { 'puppet_agent': service_names => [] } assert_match(/^#{hostname}[.\w]*\s+time=/, stdout) end end - - describe file("#{mcollective_new_paths(default)[:etc]}/server.cfg") do - it { is_expected.to exist } - its(:content) { - is_expected.to include "libdir = #{mcollective_new_paths(default)[:server_plugins]}" - is_expected.to include "libdir = #{mcollective_new_paths(default)[:libexec]}/plugins" - is_expected.to include "logfile = #{mcollective_new_paths(default)[:logs]}/mcollective.log" - is_expected.to include "plugin.yaml = #{mcollective_new_paths(default)[:facts]}" - } - end - - describe file("#{mcollective_new_paths(default)[:etc]}/client.cfg") do - it { is_expected.to exist } - its(:content) { - is_expected.to include "libdir = #{mcollective_new_paths(default)[:server_plugins]}:#{mcollective_new_paths(default)[:client_plugins]}:#{mcollective_new_paths(default)[:libexec]}" - is_expected.to include "logfile = #{mcollective_new_paths(default)[:logs]}/mcollective.log" - is_expected.to_not match /plugin.yaml[ ]*=/ - } - end end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 43eeb76d2..193d7e572 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -66,11 +66,10 @@ def install_modules_on(host) sleep 10 end -def parser_opts(master_fqdn) - # Configuration only needed on 3.x master +def agent_opts(master_fqdn) { - :main => {:stringify_facts => false, :parser => 'future', :color => 'ansi'}, - :agent => {:stringify_facts => false, :cfacter => true, :ssldir => '$vardir/ssl', :server => master_fqdn}, + :main => {:color => 'ansi'}, + :agent => {:ssldir => '$vardir/ssl', :server => master_fqdn}, } end @@ -135,9 +134,9 @@ def setup_puppet_on(host, opts = {}) puts "Setup foss puppet on #{host}" configure_defaults_on host, 'foss' - install_puppet_on host, :version => ENV['PUPPET_CLIENT_VERSION'] || '3.8.6' + install_puppet_agent_on host, :version => ENV['PUPPET_CLIENT_VERSION'] || '1.7.0' - puppet_opts = parser_opts(master.to_s) + puppet_opts = agent_opts(master.to_s) if host['platform'] =~ /windows/i # MODULES-4242: ssldir setting is cleared but files not copied on Windows upgrading from Puppet 3 puppet_opts[:agent].delete(:ssldir) @@ -145,14 +144,9 @@ def setup_puppet_on(host, opts = {}) configure_puppet_on(host, puppet_opts) if opts[:mcollective] - # On Windows, mcollective is included in the MSI even for Puppet 3 - unless host['platform'] =~ /windows/i - install_package host, 'mcollective' - install_package host, 'mcollective-client' - end stop_firewall_on host - mco_paths = mcollective_paths(host) + mco_paths = mcollective_new_paths(host) on host, "mkdir -p #{mco_paths[:etc]}" ['ca_crt.pem', 'server.crt', 'server.key', 'client.crt', 'client.key'].each do |file| @@ -173,10 +167,11 @@ def setup_puppet_on(host, opts = {}) on host, puppet('resource', 'host', activemq_host, "ip=#{master['ip'] || master.ip}") on host, puppet('resource', 'service', 'mcollective', 'ensure=stopped') on host, puppet('resource', 'service', 'mcollective', 'ensure=running') + on host, puppet('resource', 'service', 'mcollective', 'enable=true') end if opts[:agent] - puts "Clear SSL on all hosts and disable firewalls" + puts "Clean SSL on all hosts and disable firewalls" hosts.each do |host| stop_firewall_on host on(host, "rm -rf '#{host.puppet['ssldir']}'")