diff --git a/.github/workflows/acceptance.yaml b/.github/workflows/acceptance.yaml new file mode 100644 index 0000000000..7a0429ba62 --- /dev/null +++ b/.github/workflows/acceptance.yaml @@ -0,0 +1,32 @@ +--- +name: Beaker Acceptance Tests + +on: + workflow_dispatch: {} + pull_request: {} + +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 + - name: Install Ruby and Run Bundler + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + bundler-cache: true + working-directory: acceptance + - name: Output Ruby environment information + run: bundle env + - name: Run Beaker + run: bundle exec rake ci:test:docker diff --git a/.gitignore b/.gitignore index 6f746ed235..cc893f986c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ puppet-acceptance/ /acceptance/junit /acceptance/log /acceptance/.beaker +/acceptance/.vendor # emacs backup files *~ /*.samples diff --git a/acceptance/Gemfile b/acceptance/Gemfile index 2e7d52c8a0..8abe5d3f6d 100644 --- a/acceptance/Gemfile +++ b/acceptance/Gemfile @@ -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 @@ -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 diff --git a/acceptance/Rakefile b/acceptance/Rakefile index 62811cd2fc..5d5f773ee4 100644 --- a/acceptance/Rakefile +++ b/acceptance/Rakefile @@ -38,7 +38,7 @@ to clean up docker containers used for testing. EOS task :docker do begin - ENV['HOSTS'] ||= 'centos7-64a' + ENV['HOSTS'] ||= 'centos9-64a' ENV['SHA'] ||= `git rev-parse HEAD`.chomp ENV['OPTIONS'] ||= '--preserve-hosts=always' ENV['OPTIONS'] += ' --test-tag-exclude=server' diff --git a/acceptance/tests/lookup/issue_66_implementation.rb b/acceptance/tests/lookup/issue_66_implementation.rb new file mode 100644 index 0000000000..cf2313f673 --- /dev/null +++ b/acceptance/tests/lookup/issue_66_implementation.rb @@ -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