Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/acceptance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Beaker Acceptance Tests

on:
workflow_dispatch:

permissions:
contents: read

env:
RUBY_VERSION: '3.3'

jobs:
acceptance:
defaults:
run:
working-directory: acceptance
name: Acceptance Tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Ruby and Run Bundler
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true
- name: Output Ruby environment information
run: bundle env
- name: Run Beaker
run: |-
bundle exec beaker init --hosts hosts.yaml \
--preserve-hosts always --keyfile "${SSH_KEY}" \
--pre-suite pre-suite/configure_type_defaults.rb \
--tests tests
# The provision step is still needed here, see notes in the
# kvm_automation_tooling/templates/beaker-hosts.yaml.epp
# template...
bundle exec beaker provision
bundle exec beaker exec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ puppet-acceptance/
/acceptance/junit
/acceptance/log
/acceptance/.beaker
/acceptance/.vendor
# emacs backup files
*~
/*.samples
Expand Down
14 changes: 3 additions & 11 deletions acceptance/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ def location_for(place, fake_version = nil)
end

gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 6.0')
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION' || "~> 4.0"])
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || "~> 4")
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 2")
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 1.0")
gem "beaker-vagrant", *location_for(ENV['BEAKER_VAGRANT_VERSION'] || "~> 0")
gem "beaker-vmpooler", *location_for(ENV['BEAKER_VMPOOLER_VERSION'] || "~> 1.3")
gem "beaker-vcloud", *location_for(ENV['BEAKER_VCLOUD_VERSION'] || "~> 1.0")
gem "beaker-docker", *location_for(ENV['BEAKER_DOCKER_VERSION'] || "~> 0.5")
gem "beaker-gke", *location_for(ENV['BEAKER_GKE_VERSION'] || "~> 0.0.3")
gem "beaker-vagrant", *location_for(ENV['BEAKER_VAGRANT_VERSION'] || "~> 1.4")
gem "beaker-docker", *location_for(ENV['BEAKER_DOCKER_VERSION'] || "~> 2.6")
gem "rake", ">= 12.3.3"
gem "httparty", :require => false
gem 'uuidtools', :require => false
Expand All @@ -29,7 +25,3 @@ group(:test) do
gem "rspec", "~> 2.14.0", :require => false
gem "mocha", "~> 0.10.5", :require => false
end

if File.exist? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end
57 changes: 57 additions & 0 deletions acceptance/tests/lookup/issue_66_implementation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# test for https://github.com/OpenVoxProject/openvox-agent/issues/66
test_name 'Warning about implementatin during puppet lookup' do
require 'puppet/acceptance/puppet_type_test_tools.rb'
extend Puppet::Acceptance::PuppetTypeTestTools

# bastelfreak: I've no idea what those tags do, I copied them from lookup/v4_hieradata_with_v5_configs.rb
tag 'audit:high',
'audit:acceptance',
'audit:refactor', # Master is not needed for this test. Refactor
# to use puppet apply with a local module tree.

app_type = File.basename(__FILE__, '.*')
tmp_environment = mk_tmp_environment_with_teardown(master, app_type)
fq_tmp_environmentpath = "#{environmentpath}/#{tmp_environment}"

confdir = puppet_config(master, 'confdir', section: 'master')
hiera_conf_backup = master.tmpfile('66-hiera-yaml')

step "backup global hiera.yaml" do
on(master, "cp -a #{confdir}/hiera.yaml #{hiera_conf_backup}", :acceptable_exit_codes => [0,1])
end

teardown do
step "restore global hiera.yaml" do
on(master, "mv #{hiera_conf_backup} #{confdir}/hiera.yaml", :acceptable_exit_codes => [0,1])
end

agents.each do |agent|
on(agent, puppet('config print lastrunfile')) do |command_result|
agent.rm_rf(command_result.stdout)
end
end
end

step "create global hiera.yaml and data" do
create_remote_file(master, "#{confdir}/hiera.yaml", <<-HIERA)
---
version: 5
hierarchy:
- name: common
data_hash: yaml_data
path: "common.yaml"
HIERA
on(master, "chmod 755 #{confdir}/hiera.yaml")
create_remote_file(master, "#{confdir}/common.yaml", <<-YAML)
---
environment_key: environment_key-global_common_file
global_key: global_key-global_common_file
YAML
end

step 'assert lookups using lookup subcommand' do
on(master, puppet('lookup', 'environment_key'), :accept_all_exit_codes => true) do |result|
assert_match(/Warning: The node parameter 'implementation' for node '.*' was already set to 'openvox'. It could not be set to 'openvox'/, result.stderr)
end
end
end
Loading