I started using beaker rspec and would like to simulate a `puppet agent -t` in order to run some module testing.
**default.yaml**
HOSTS:
ubuntu-1404-x64-master:
roles:
- agent
- default
- master
- dashboard
- database
platform: ubuntu-14.04-amd64
hypervisor: vagrant
vagrant_memsize: 4096
box: puppetlabs/ubuntu-14.04-64-nocm
CONFIG:
type: foss
consoleport: 443
**spec_helper_acceptance.rb**
require 'beaker-rspec'
#require 'beaker-rspec/spec_helper'
#require 'beaker-rspec/helpers/serverspec'
require 'beaker/puppet_install_helper'
#require 'beaker/module_install_helper'
# Install Puppet on all hosts
install_puppet_agent_on(hosts, options)
run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no'
RSpec.configure do |c|
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
c.formatter = :documentation
c.before :suite do
# Install module to all hosts
hosts.each do |host|
install_dev_puppet_module_on(host, :source => module_root, :module_name => 'lm3corp_rsyslog',
:target_module_path => '/etc/puppetlabs/code/environments/production/modules')
# Install dependencies
on(host, puppet('module', 'install', 'puppetlabs-stdlib'))
on(host, puppet('module', 'install', 'saz-rsyslog'))
# Add more setup code as needed
end
end
end
**test_spec.rb**
require 'spec_helper_acceptance'
apply_manifests_opts = {
:catch_failures => true,
:modulepath => '/etc/puppetlabs/code/environments/production/modules',
:debug => true
}
describe 'my_wrapper_class::client class' do
pp = <<-EOS
class { 'my_wrapper_class::client': }
EOS
it 'should run without errors' do
result = apply_manifest(pp, apply_manifests_opts )
expect(result.exit_code).to eq 2
end
#TODO: after creating a server and a client a file on the server should contain some sort of logging from the client
#
end
In the output I can see that beaker executed the manifest with puppet apply. Is there a way to set the command to
puppet agent -t
puppet apply --debug --detailed-exitcodes --modulepath=/etc/puppetlabs/code/environments/production/modules /tmp/apply_manifest.pp.mZvSN6
↧