Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to beaker_puppet_helpers #31

Closed
wants to merge 4 commits into from
Closed
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
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ jobs:
fail-fast: false
matrix:
ruby:
- '2.4'
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
Comment on lines +34 to +35
Copy link
Member

@bastelfreak bastelfreak May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should drop 2.5 and 2.6 as well

Suggested change
- '2.6'
- '2.5'

name: Unit / Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v3
Expand All @@ -56,12 +55,11 @@ jobs:
fail-fast: false
matrix:
ruby:
- '2.4'
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.0'
- '2.7'
- '2.6'
- '2.5'
Comment on lines +61 to +62
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- '2.6'
- '2.5'

example: ${{ fromJson(needs.pre.outputs.examples) }}
name: Acceptance / Ruby ${{ matrix.ruby }} - ${{ matrix.example }}
steps:
Expand Down
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ source 'https://rubygems.org'

gemspec

# TODO: pending a release
gem 'beaker_puppet_helpers', github: 'voxpupuli/beaker_puppet_helpers'

group :release do
gem 'github_changelog_generator', '~> 1.16', require: false if RUBY_VERSION >= '2.5'
gem 'github_changelog_generator', '~> 1.16', require: false
end
3 changes: 3 additions & 0 deletions examples/defaults_basic_dependency/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source 'https://rubygems.org'

# TODO: pending a release
gem 'beaker_puppet_helpers', github: 'voxpupuli/beaker_puppet_helpers'

gem 'voxpupuli-acceptance', path: '../..'
3 changes: 3 additions & 0 deletions examples/defaults_facts/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source 'https://rubygems.org'

# TODO: pending a release
gem 'beaker_puppet_helpers', github: 'voxpupuli/beaker_puppet_helpers'

gem 'voxpupuli-acceptance', path: '../..'
3 changes: 3 additions & 0 deletions examples/defaults_fixtures/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
source 'https://rubygems.org'

# TODO: pending a release
gem 'beaker_puppet_helpers', github: 'voxpupuli/beaker_puppet_helpers'

gem 'voxpupuli-acceptance', path: '../..'
gem 'puppetlabs_spec_helper'
3 changes: 3 additions & 0 deletions examples/defaults_no_dependencies/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source 'https://rubygems.org'

# TODO: pending a release
gem 'beaker_puppet_helpers', github: 'voxpupuli/beaker_puppet_helpers'

gem 'voxpupuli-acceptance', path: '../..'
3 changes: 3 additions & 0 deletions examples/no_modules/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
source 'https://rubygems.org'

# TODO: pending a release
gem 'beaker_puppet_helpers', github: 'voxpupuli/beaker_puppet_helpers'

gem 'voxpupuli-acceptance', path: '../..'
2 changes: 1 addition & 1 deletion lib/voxpupuli/acceptance/fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def install_modules_on(hosts, modules, logger = nil)
logger.debug("Copying module #{name} from #{source_path} to #{target_file}") if logger

scp_to(host, source_path, target_file)
on host, puppet("module install --force --ignore-dependencies '#{target_file}'")
on host, "puppet module install --force --ignore-dependencies '#{target_file}'"
end
end
end
Expand Down
25 changes: 11 additions & 14 deletions lib/voxpupuli/acceptance/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
require_relative 'examples'

def configure_beaker(modules: :metadata, &block)
ENV['PUPPET_INSTALL_TYPE'] ||= 'agent'
ENV['BEAKER_PUPPET_COLLECTION'] ||= 'puppet7'
collection = ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet')
ENV['BEAKER_debug'] ||= 'true'
ENV['BEAKER_HYPERVISOR'] ||= 'docker'

# On Ruby 3 this doesn't appear to matter but on Ruby 2 beaker-hiera must be
# included before beaker-rspec so Beaker::DSL is final
require 'beaker-hiera'
require 'beaker_puppet_helpers'
require 'beaker-rspec'
require 'beaker-puppet'
require 'beaker/puppet_install_helper'

case modules
when :metadata
require 'beaker/module_install_helper'
$module_source_dir = get_module_source_directory caller
when :fixtures
require_relative 'fixtures'
end
require_relative 'fixtures' if modules == :fixtures

run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no'
unless ENV['BEAKER_provision'] == 'no'
block_on hosts, run_in_parallel: true do |host|
BeakerPuppetHelpers::InstallUtils.install_puppet_release_repo_on(host, collection) unless collection.empty?
package_name = BeakerPuppetHelpers::InstallUtils.puppet_package_name(host)
host.install_package(package_name)
end
end

RSpec.configure do |c|
# Readable test descriptions
Expand All @@ -31,8 +29,7 @@ def configure_beaker(modules: :metadata, &block)
c.before :suite do
case modules
when :metadata
install_module
install_module_dependencies
install_local_module_on(hosts)
when :fixtures
fixture_modules = File.join(Dir.pwd, 'spec', 'fixtures', 'modules')
Voxpupuli::Acceptance::Fixtures.install_fixture_modules_on(hosts, fixture_modules)
Expand Down
6 changes: 2 additions & 4 deletions voxpupuli-acceptance.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ Gem::Specification.new do |s|

s.files = Dir['lib/**/*.rb']

s.required_ruby_version = '>= 2.4', '< 4'
s.required_ruby_version = '>= 2.5', '< 4'

# Testing
s.add_runtime_dependency 'bcrypt_pbkdf'
s.add_runtime_dependency 'beaker', '~> 4.33'
s.add_runtime_dependency 'beaker-docker'
s.add_runtime_dependency 'beaker-hiera', '~> 0.4'
s.add_runtime_dependency 'beaker-hostgenerator', '>= 1.1.22'
s.add_runtime_dependency 'beaker-module_install_helper'
s.add_runtime_dependency 'beaker-puppet'
s.add_runtime_dependency 'beaker-puppet_install_helper'
s.add_runtime_dependency 'beaker_puppet_helpers'
s.add_runtime_dependency 'beaker-rspec'
s.add_runtime_dependency 'beaker-vagrant'
s.add_runtime_dependency 'puppet-modulebuilder', '~> 0.1'
Expand Down