Skip to content

Commit

Permalink
WIP: Figure out how to test task in acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjfisher committed Oct 18, 2019
1 parent 442424c commit e8e7da3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fixtures:
git: 'https://github.com/theforeman/puppet-git.git'
inifile: 'https://github.com/puppetlabs/puppetlabs-inifile.git'
puppetdb: 'https://github.com/puppetlabs/puppetlabs-puppetdb.git'
ruby_task_helper: 'https://github.com/puppetlabs/puppetlabs-ruby_task_helper.git'
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
systemd: 'https://github.com/camptocamp/puppet-systemd.git'
yumrepo_core:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ matrix:
env:
- BEAKER_PUPPET_COLLECTION=puppet6
- BEAKER_setfile=centos7-64{hostname=centos7-64.example.com}
script: bundle exec rake beaker
script: bundle exec rake spec_prep beaker
services: docker
bundler_args: --without development
before_install:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ gem 'beaker-puppet_install_helper', {"groups"=>["system_tests"]}
gem 'metadata-json-lint'
gem 'kafo_module_lint'
gem 'parallel_tests'
gem 'bolt', '~> 1.15'
gem 'beaker-task_helper', '~> 1.5.2'

# vim:ft=ruby
1 change: 1 addition & 0 deletions spec/acceptance/nodesets/centos-7-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ HOSTS:
centos-7-x64:
roles:
- master
- target
platform: centos-7-x86_64
box: centos/7
hypervisor: vagrant
Expand Down
25 changes: 25 additions & 0 deletions spec/acceptance/run_agent_task_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'spec_helper_acceptance'
require 'beaker-task_helper/inventory'
require 'bolt_spec/run'

describe 'run_agent task' do
include Beaker::TaskHelper::Inventory
include BoltSpec::Run

def module_path
RSpec.configuration.module_path
end

def bolt_config
{ 'modulepath' => File.join(File.dirname(File.expand_path(__FILE__)),'../','fixtures', 'modules') }
end

def bolt_inventory
hosts_to_inventory
end

it 'works - HA! I wish!' do
results = run_task('puppet::run_agent', 'target', {})
pp results
end
end
3 changes: 3 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
ENV['BEAKER_setfile'] ||= 'centos7-64{hostname=centos7-64.example.com}'
ENV['BEAKER_HYPERVISOR'] ||= 'docker'

require 'bolt/pal'
Bolt::PAL.load_puppet

require 'beaker-puppet'
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
Expand Down

0 comments on commit e8e7da3

Please sign in to comment.