Skip to content

Standardize and updated nodesets & ensure working beaker tests #305

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 6 additions & 5 deletions .github/workflows/pr_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install Ruby 2.7"
- name: "Install Ruby ${{matrix.puppet.ruby_version}}"
uses: ruby/setup-ruby@v1 # ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
with:
ruby-version: 2.7
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install Ruby 2.7"
- name: "Install Ruby ${{matrix.puppet.ruby_version}}"
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
Expand All @@ -56,12 +56,13 @@ jobs:
- run: "bundle exec rake metadata_lint"

ruby-style:
name: 'Ruby Style'
if: false # TODO Modules will need: rubocop in Gemfile, .rubocop.yml
name: 'Ruby Style (experimental)'
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: "Install Ruby 2.7"
- name: "Install Ruby ${{matrix.puppet.ruby_version}}"
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
Expand All @@ -88,7 +89,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Install Ruby 2.7'
- name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* Thu May 08 2025 Richard Gardner <rick@sicura-us> - 5.0.0
- Remove EOL OS's support (EL7)
- Stardardize beaker nodesets
- beaker test improvements

* Mon Dec 30 2024 Steven Pritchard <[email protected]> - 4.14.0
- Fix use of legacy facts (#301)

Expand Down
13 changes: 3 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,16 @@ ENV['PDK_DISABLE_ANALYTICS'] ||= 'true'

gem_sources.each { |gem_source| source gem_source }

group :syntax do
gem 'metadata-json-lint'
gem 'puppet-lint-trailing_comma-check', require: false
gem 'rubocop', '~> 1.69.2'
gem 'rubocop-performance', '~> 1.23.0'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-rspec', '~> 3.3.0'
end

group :test do
puppet_version = ENV.fetch('PUPPET_VERSION', ['>= 7', '< 9'])
major_puppet_version = Array(puppet_version).first.scan(%r{(\d+)(?:\.|\Z)}).flatten.first.to_i
gem 'hiera-puppet-helper'
gem 'metadata-json-lint'
gem 'pathspec', '~> 0.2' if Gem::Requirement.create('< 2.6').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem('pdk', ENV.fetch('PDK_VERSION', ['>= 2.0', '< 4.0']), require: false) if major_puppet_version > 5
gem 'puppet', puppet_version
gem 'puppetlabs_spec_helper'
gem 'puppet-lint-trailing_comma-check', require: false
gem 'puppet-strings'
gem 'rake'
gem 'rspec'
Expand All @@ -45,7 +38,7 @@ group :system_tests do
gem 'bcrypt_pbkdf'
gem 'beaker'
gem 'beaker-rspec'
gem 'simp-beaker-helpers', ENV.fetch('SIMP_BEAKER_HELPERS_VERSION', ['>= 1.34.3', '< 2'])
gem 'simp-beaker-helpers', ENV.fetch('SIMP_BEAKER_HELPERS_VERSION', ['>= 1.32.1', '< 2'])
end

# Evaluate extra gemfiles if they exist
Expand Down
2 changes: 1 addition & 1 deletion manifests/stages.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
class simplib::stages {
include stdlib::stages

stage { 'simp_prep': before => Stage['setup'] }
stage { 'simp_prep': before => Stage['setup'] }
stage { 'simp_finalize': require => Stage['deploy'] }
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-simplib",
"version": "4.14.0",
"version": "5.0.0",
"author": "SIMP Team",
"summary": "A collection of common SIMP functions, facts, and types",
"license": "Apache-2.0",
Expand Down
26 changes: 7 additions & 19 deletions spec/acceptance/nodesets/default.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
---
HOSTS:
el7:
roles:
- client
- default
- master
- prelink
platform: el-7-x86_64
box: centos/7
el9:
platform: el-9-x86_64
box: generic/rocky9
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
family: centos-cloud/centos-7
gce_machine_type: n1-standard-2
el8:
roles:
- client
platform: el-8-x86_64
box: generic/centos8
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
family: centos-cloud/centos-stream-8
family: rocky-linux-cloud/rocky-linux-9
gce_machine_type: n1-standard-2
CONFIG:
log_level: verbose
synced_folder: disabled
type: aio
vagrant_cpus: 1
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet7') %>"
vagrant_memsize: 256
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
26 changes: 0 additions & 26 deletions spec/acceptance/nodesets/oel.yml

This file was deleted.

14 changes: 14 additions & 0 deletions spec/acceptance/nodesets/oel8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
HOSTS:
oel8:
platform: el-8-x86_64
box: generic/oracle8
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
family: sicura-image-build/oracle-linux-8
gce_machine_type: n1-standard-2
CONFIG:
log_level: verbose
synced_folder: disabled
type: aio
vagrant_memsize: 256
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
14 changes: 14 additions & 0 deletions spec/acceptance/nodesets/oel9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
HOSTS:
oel9:
platform: el-9-x86_64
box: generic/oracle9
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
family: sicura-image-build/oracle-linux-9
gce_machine_type: n1-standard-2
CONFIG:
log_level: verbose
synced_folder: disabled
type: aio
vagrant_memsize: 256
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
36 changes: 0 additions & 36 deletions spec/acceptance/nodesets/rhel7.yml

This file was deleted.

15 changes: 4 additions & 11 deletions spec/acceptance/nodesets/rhel8.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
---
HOSTS:
server-el8:
roles:
- server
- default
- master
el8:
platform: el-8-x86_64
box: generic/rhel8
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
yum_repos:
epel:
mirrorlist: https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch
gpgkeys:
- https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
family: rhel-cloud/rhel-8
gce_machine_type: n1-standard-2
CONFIG:
log_level: verbose
synced_folder: disabled
type: aio
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet7') %>"
vagrant_memsize: 256
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
14 changes: 14 additions & 0 deletions spec/acceptance/nodesets/rhel9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
HOSTS:
el9:
platform: el-9-x86_64
box: generic/rhel9
hypervisor: "<%= ENV.fetch('BEAKER_HYPERVISOR', 'vagrant') %>"
family: rhel-cloud/rhel-9
gce_machine_type: n1-standard-2
CONFIG:
log_level: verbose
synced_folder: disabled
type: aio
vagrant_memsize: 256
puppet_collection: "<%= ENV.fetch('BEAKER_PUPPET_COLLECTION', 'puppet8') %>"
52 changes: 26 additions & 26 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# frozen_string_literal: true

#
# ------------------------------------------------------------------------------
# NOTICE: **This file is maintained with puppetsync**
Expand All @@ -25,22 +24,22 @@
end

default_hiera_config = <<~HIERA_CONFIG
---
version: 5
hierarchy:
- name: SIMP Compliance Engine
lookup_key: compliance_markup::enforcement
options:
enabled_sce_versions: [2]
- name: Custom Test Hiera
path: "%{custom_hiera}.yaml"
- name: "%{module_name}"
path: "%{module_name}.yaml"
- name: Common
path: default.yaml
defaults:
data_hash: yaml_data
datadir: "stub"
---
version: 5
hierarchy:
- name: SIMP Compliance Engine
lookup_key: compliance_markup::enforcement
options:
enabled_sce_versions: [2]
- name: Custom Test Hiera
path: "%{custom_hiera}.yaml"
- name: "%{module_name}"
path: "%{module_name}.yaml"
- name: Common
path: default.yaml
defaults:
data_hash: yaml_data
datadir: "stub"
HIERA_CONFIG

# This can be used from inside your spec tests to set the testable environment.
Expand Down Expand Up @@ -91,17 +90,16 @@ def set_hieradata(hieradata)
# If nothing else...
c.default_facts = {
production: {
# :fqdn => 'production.rspec.test.localdomain',
#:fqdn => 'production.rspec.test.localdomain',
path: '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
concat_basedir: '/tmp',
},
concat_basedir: '/tmp'
}
}

c.mock_framework = :rspec
c.mock_with :rspec

c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests') if c.respond_to?(:manifest_dir)

c.hiera_config = File.join(fixture_path, 'hieradata', 'hiera.yaml')

Expand Down Expand Up @@ -152,9 +150,9 @@ def set_hieradata(hieradata)

# sanitize hieradata
if defined?(hieradata)
set_hieradata(hieradata.tr(':', '_'))
set_hieradata(hieradata.gsub(':', '_'))
elsif defined?(class_name)
set_hieradata(class_name.tr(':', '_'))
set_hieradata(class_name.gsub(':', '_'))
end
end

Expand All @@ -166,7 +164,9 @@ def set_hieradata(hieradata)
end

Dir.glob("#{RSpec.configuration.module_path}/*").each do |dir|
Pathname.new(dir).realpath
rescue StandardError
raise "ERROR: The module '#{dir}' is not installed. Tests cannot continue."
begin
Pathname.new(dir).realpath
rescue StandardError
raise "ERROR: The module '#{dir}' is not installed. Tests cannot continue."
end
end
Loading