simp-beaker-helpers 2.0.4 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3916923de88666ed3a88a41f3053dca5791fb456d6386121c6a85c40641113e6
4
- data.tar.gz: f1ebb8c0b1c9faf276537948cf31432305715921476132e4c39fff0411a36c79
3
+ metadata.gz: 4e51892c7f01f52c49e29840032a8e4b7d5f524a3c3160b3218d3839224bfaf6
4
+ data.tar.gz: abbce77cea4030bcc802eaa16359e5f53998fb1dda40cd8dbb5aa11e56fff768
5
5
  SHA512:
6
- metadata.gz: d639af43846bb7c711d42348f035e096c54afcc1b7a8e6db537412dbee093d5d2618e2f329a8fd95865d5514d59d2ecc0d33842334d1d1978e1f984e65b92497
7
- data.tar.gz: 3b77cd3c5403c706a4198e8cc95465e504aac01640e5e614a6bf3aa1b8390a5e0a9e8a170852c9448f7738cf38ecdbb1299e84b02a770b3ac215946493809d36
6
+ metadata.gz: 3c0c3ef0740aef92c4dcb643b94ac228d5484a0ad524b7b419832f30e28caa63f4ba802bf48d721ae242af7a387cc291582e33e9ad23ef345f6bc88105161f67
7
+ data.tar.gz: 61829ea33bf1911ee6da64d46b29f270f907631c01b3e681b62ac4650716ccaeba4d3d8dababc07cfea1eb8400b1bd2ab72d8528940e296bf4e35f290f36ddac
@@ -15,7 +15,7 @@ jobs:
15
15
  name: Add issue to project
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/add-to-project@v1.0.2
18
+ - uses: actions/add-to-project@v2
19
19
  with:
20
20
  project-url: https://github.com/orgs/simp/projects/11
21
21
  github-token: ${{ secrets.AUTO_TRIAGE_TOKEN }}
@@ -17,14 +17,6 @@ jobs:
17
17
  strategy:
18
18
  matrix:
19
19
  puppet:
20
- - label: 'Puppet 7.x [SIMP 6.6/PE 2021.7]'
21
- puppet_version: '~> 7.0'
22
- ruby_version: '2.7'
23
- experimental: false
24
- - label: 'Puppet 8.x'
25
- puppet_version: '~> 8.0'
26
- ruby_version: '3.2'
27
- experimental: false
28
20
  - label: 'OpenVox 8.x'
29
21
  puppet_version: '~> 8.0'
30
22
  ruby_version: '3.2'
@@ -37,9 +29,6 @@ jobs:
37
29
  - label: beaker puppet_collections
38
30
  suite: puppet_collections
39
31
  allowed_to_fail: false
40
- - label: beaker ssg
41
- suite: ssg
42
- allowed_to_fail: false
43
32
  # The inspec suite fails for unclear reasons during an scp.
44
33
  # Sicura tests compliance at the framework level, so troubleshooting
45
34
  # inspec acceptance tests is not a priority at present.
@@ -51,7 +40,7 @@ jobs:
51
40
  PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
52
41
  steps:
53
42
  - name: checkout repo
54
- uses: actions/checkout@v5
43
+ uses: actions/checkout@v7
55
44
  - name: setup ruby
56
45
  uses: ruby/setup-ruby@v1
57
46
  with:
@@ -32,11 +32,11 @@ jobs:
32
32
  runs-on: ubuntu-latest
33
33
  continue-on-error: true
34
34
  steps:
35
- - uses: actions/checkout@v5
35
+ - uses: actions/checkout@v7
36
36
  - name: "Install Ruby 3.2"
37
37
  uses: ruby/setup-ruby@v1
38
38
  with:
39
- ruby-version: 3.2
39
+ ruby-version: 4.0.5
40
40
  bundler-cache: true
41
41
  - run: |
42
42
  bundle show
@@ -48,18 +48,20 @@ jobs:
48
48
  strategy:
49
49
  matrix:
50
50
  puppet:
51
- - label: 'Puppet 7.x [SIMP 6.6/PE 2021.7]'
52
- puppet_version: '~> 7.0'
53
- ruby_version: '2.7'
54
- experimental: false
55
- - label: 'Puppet 8.x'
51
+ - label: 'OpenVox 8.x'
56
52
  puppet_version: '~> 8.0'
57
53
  ruby_version: '3.2'
58
54
  experimental: false
55
+ # OpenVox 9 is unreleased; preview the future Ruby 4.0 / OpenVox 9
56
+ # combo by running the OpenVox 8 gem on Ruby 4.0.
57
+ - label: 'OpenVox 9.x preview (Ruby 4.0, OpenVox 8 gem)'
58
+ puppet_version: '~> 8.0'
59
+ ruby_version: '4.0'
60
+ experimental: false
59
61
  env:
60
62
  PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
61
63
  steps:
62
- - uses: actions/checkout@v5
64
+ - uses: actions/checkout@v7
63
65
  - name: 'Install Ruby ${{matrix.puppet.ruby_version}}'
64
66
  uses: ruby/setup-ruby@v1
65
67
  with:
@@ -48,7 +48,7 @@ on:
48
48
  - '[0-9]+\.[0-9]+\.[0-9]+\-[a-z]+[0-9]+'
49
49
 
50
50
  env:
51
- PUPPET_VERSION: '~> 7'
51
+ PUPPET_VERSION: '~> 8'
52
52
  LOCAL_WORKFLOW_CONFIG_FILE: .github/workflows.local.json
53
53
 
54
54
  jobs:
@@ -63,7 +63,7 @@ jobs:
63
63
  steps:
64
64
  - name: "Assert '${{ github.ref }}' is a tag"
65
65
  run: '[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || { echo "::error ::GITHUB_REF is not a tag: ${GITHUB_REF}"; exit 1 ; }'
66
- - uses: actions/checkout@v5
66
+ - uses: actions/checkout@v7
67
67
  with:
68
68
  ref: ${{ github.ref }}
69
69
  clean: true
@@ -92,7 +92,7 @@ jobs:
92
92
  echo "release_command=$GEM_RELEASE_COMMAND" | tee -a "$GITHUB_OUTPUT"
93
93
  - uses: ruby/setup-ruby@v1
94
94
  with:
95
- ruby-version: 2.7
95
+ ruby-version: 4.0.5
96
96
  bundler-cache: true
97
97
  - name: Test build the package
98
98
  run: "${{ steps.commands.outputs.build_command }}"
@@ -116,7 +116,7 @@ jobs:
116
116
  tag: ${{ steps.tag-check.outputs.tag }}
117
117
  steps:
118
118
  - name: Checkout code
119
- uses: actions/checkout@v5
119
+ uses: actions/checkout@v7
120
120
  with:
121
121
  ref: ${{ github.ref }}
122
122
  clean: true
@@ -178,13 +178,13 @@ jobs:
178
178
  PKG_DIR: ${{ needs.releng-checks.outputs.pkg_dir }}
179
179
  steps:
180
180
  - name: Checkout code
181
- uses: actions/checkout@v5
181
+ uses: actions/checkout@v7
182
182
  with:
183
183
  ref: ${{ github.ref }}
184
184
  clean: true
185
185
  - uses: ruby/setup-ruby@v1
186
186
  with:
187
- ruby-version: 2.7
187
+ ruby-version: 4.0.5
188
188
  bundler-cache: true
189
189
  - name: Build RubyGem
190
190
  run: |
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ### 3.0.0 / 2026-06-24
2
+ * Changed (**Breaking**):
3
+ * Dropped support for Puppet 7 / Ruby 2.7. CI now tests Puppet/OpenVox 8 only,
4
+ and the default OpenVox gem floor is raised to `>= 8.0.0`.
5
+ * Replaced the `puppetlabs_spec_helper/tasks/fixtures` dependency with
6
+ `puppet_fixtures`, enabling Ruby 4.0 support. `puppetlabs_spec_helper` pulls
7
+ in `puppet-syntax` < 5, which depends on the `puppet` gem and its `facter`
8
+ dependency that does not support Ruby >= 4.0; `puppet_fixtures` is the
9
+ OpenVox-ecosystem replacement and supports Ruby 4.0.
10
+ * The `beaker:suites` task now depends on `fixtures:prep` (from
11
+ `puppet_fixtures`) instead of `spec_prep`, and `ensure_fixture_modules` now
12
+ runs `rake fixtures:prep`.
13
+ * Removed (**Breaking**):
14
+ * Removed the unsupported `Simp::BeakerHelpers::SSG` helpers, the `ssg`
15
+ acceptance suite, and the `SSG_REPO_URL` constant (#268)
16
+ * Added:
17
+ * `puppet_fixtures` runtime dependency
18
+ * OpenVox-named environment variables for `get_puppet_install_info`, taking
19
+ precedence over the Puppet-named equivalents (which remain as fallbacks):
20
+ `OPENVOX_VERSION`, `OPENVOX_INSTALL_VERSION`, `OPENVOX_INSTALL_TYPE`,
21
+ `BEAKER_OPENVOX_AGENT_VERSION`, `BEAKER_OPENVOX_COLLECTION`,
22
+ `BEAKER_OPENVOX_PACKAGE_NAME`
23
+
24
+ ### 2.0.5 / 2026-06-06
25
+ * Fixed:
26
+ * Additional cleanup for rubocop
1
27
  ### 2.0.4 / 2025-10-16
2
28
  * Fixed:
3
29
  * `install_puppet` failure on Windows (#266)
data/Gemfile CHANGED
@@ -40,15 +40,15 @@ group :system_tests do
40
40
  gem 'beaker-windows'
41
41
  gem 'ed25519'
42
42
  gem 'net-ssh'
43
- gem 'openvox', ENV.fetch('OPENVOX_VERSION', ENV.fetch('PUPPET_VERSION', ['>= 7.0.0', '< 9.0.0']))
44
- gem 'pry-byebug', '~> 3.10.0'
45
- gem 'puppetlabs_spec_helper', '>= 4.0.0', '< 9.0.0'
43
+ # renovate: datasource=rubygems versioning=ruby
44
+ gem 'openvox', ENV.fetch('OPENVOX_VERSION', ENV.fetch('PUPPET_VERSION', ['>= 8.0.0', '< 9.0.0']))
45
+ gem 'pry-byebug', '~> 3.12.0'
46
46
  gem 'syslog' # Required for Ruby >= 3.4
47
47
  end
48
48
 
49
49
  group :tests do
50
- gem 'rubocop', '~> 1.81.0'
50
+ gem 'rubocop', '~> 1.88.0'
51
51
  gem 'rubocop-performance', '~> 1.26.0'
52
52
  gem 'rubocop-rake', '~> 0.7.0'
53
- gem 'rubocop-rspec', '~> 3.7.0'
53
+ gem 'rubocop-rspec', '~> 3.10.0'
54
54
  end
@@ -2,15 +2,13 @@
2
2
  module Simp; end
3
3
 
4
4
  # SIMP Beaker helper methods for testing
5
- module Simp::BeakerHelpers
5
+ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
6
6
  # This is the *oldest* puppet-agent version that the latest release of SIMP supports
7
7
  #
8
8
  # This is done so that we know if some new thing that we're using breaks the
9
9
  # oldest system that we support
10
10
  DEFAULT_PUPPET_AGENT_VERSION = '~> 8.0'.freeze
11
11
 
12
- SSG_REPO_URL = ENV['BEAKER_ssg_repo'] || 'https://github.com/ComplianceAsCode/content.git'
13
-
14
12
  if ['true', 'yes'].include?(ENV['BEAKER_online'])
15
13
  ONLINE = true
16
14
  elsif ['false', 'no'].include?(ENV['BEAKER_online'])
@@ -3,6 +3,6 @@
3
3
  # SIMP namespace
4
4
  module Simp; end
5
5
 
6
- module Simp::BeakerHelpers
7
- VERSION = '2.0.4'
6
+ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
7
+ VERSION = '3.0.0'
8
8
  end
@@ -1,10 +1,10 @@
1
1
  # SIMP namespace
2
2
  module Simp; end
3
3
  # SIMP Beaker helper methods for testing
4
- module Simp::BeakerHelpers; end
4
+ module Simp::BeakerHelpers; end # rubocop:disable Style/OneClassPerFile
5
5
 
6
6
  # Windows-specific helper methods
7
- module Simp::BeakerHelpers::Windows
7
+ module Simp::BeakerHelpers::Windows # rubocop:disable Style/OneClassPerFile
8
8
  begin
9
9
  require 'beaker-windows'
10
10
  rescue LoadError
@@ -7,14 +7,13 @@ require 'bundler'
7
7
  module Simp; end
8
8
 
9
9
  # SIMP Beaker helper methods for testing
10
- module Simp::BeakerHelpers
10
+ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
11
11
  include BeakerPuppetHelpers
12
12
  include BeakerPuppetHelpers::DSL
13
13
 
14
14
  require 'simp/beaker_helpers/constants'
15
15
  require 'simp/beaker_helpers/inspec'
16
16
  require 'simp/beaker_helpers/snapshot'
17
- require 'simp/beaker_helpers/ssg'
18
17
  require 'simp/beaker_helpers/version'
19
18
  require 'find'
20
19
 
@@ -367,8 +366,8 @@ module Simp::BeakerHelpers
367
366
  if missing_modules.empty?
368
367
  puts ' == all fixture modules present'
369
368
  else
370
- cmd = 'bundle exec rake spec_prep'
371
- puts " -- running spec_prep: '#{cmd}'"
369
+ cmd = 'bundle exec rake fixtures:prep'
370
+ puts " -- running fixtures:prep: '#{cmd}'"
372
371
  `#{cmd}`
373
372
  end
374
373
  end
@@ -1235,13 +1234,13 @@ module Simp::BeakerHelpers
1235
1234
  data_dir = Dir.mktmpdir('hieradata')
1236
1235
  @temp_hieradata_dirs << data_dir
1237
1236
 
1238
- fh = File.open(File.join(data_dir, 'common.yaml'), 'w')
1239
- if hieradata.is_a?(String)
1240
- fh.puts(hieradata)
1241
- else
1242
- fh.puts(hieradata.to_yaml)
1237
+ File.open(File.join(data_dir, 'common.yaml'), 'w') do |fh|
1238
+ if hieradata.is_a?(String)
1239
+ fh.puts(hieradata)
1240
+ else
1241
+ fh.puts(hieradata.to_yaml)
1242
+ end
1243
1243
  end
1244
- fh.close
1245
1244
 
1246
1245
  copy_hiera_data_to sut, File.join(data_dir, 'common.yaml')
1247
1246
  end
@@ -1426,16 +1425,25 @@ module Simp::BeakerHelpers
1426
1425
  # install version and a puppet collection are specified. This is
1427
1426
  # because the puppet install version can specify more precise
1428
1427
  # version information than is available from a puppet collection.
1428
+ #
1429
+ # Each Puppet-named environment variable has an OpenVox-named
1430
+ # equivalent (e.g. OPENVOX_VERSION, BEAKER_OPENVOX_COLLECTION) that
1431
+ # takes precedence; the Puppet-named variables are kept as fallbacks
1432
+ # for backwards compatibility.
1429
1433
  def get_puppet_install_info
1430
- # The first match is internal Beaker and the second is legacy SIMP
1431
- puppet_install_version = ENV['BEAKER_PUPPET_AGENT_VERSION'] || ENV['PUPPET_INSTALL_VERSION'] || ENV['PUPPET_VERSION']
1434
+ # OpenVox-named variables win; the Puppet-named ones remain as fallbacks.
1435
+ # Within each pair the first match is internal Beaker, the second legacy SIMP.
1436
+ puppet_install_version =
1437
+ ENV['BEAKER_OPENVOX_AGENT_VERSION'] || ENV['BEAKER_PUPPET_AGENT_VERSION'] ||
1438
+ ENV['OPENVOX_INSTALL_VERSION'] || ENV['PUPPET_INSTALL_VERSION'] ||
1439
+ ENV['OPENVOX_VERSION'] || ENV['PUPPET_VERSION']
1432
1440
 
1433
1441
  if puppet_install_version && !puppet_install_version.strip.empty?
1434
1442
  puppet_agent_version = latest_puppet_agent_version_for(puppet_install_version.strip)
1435
1443
  end
1436
1444
 
1437
1445
  if puppet_agent_version.nil?
1438
- if (puppet_collection = ENV['BEAKER_PUPPET_COLLECTION'] || host.options['puppet_collection'])
1446
+ if (puppet_collection = ENV['BEAKER_OPENVOX_COLLECTION'] || ENV['BEAKER_PUPPET_COLLECTION'] || host.options['puppet_collection'])
1439
1447
  raise("Error: Puppet Collection '#{puppet_collection}' must match /(puppet|openvox)(\\d+)/") unless puppet_collection =~ %r{(puppet|openvox)(\d+)}
1440
1448
  puppet_collection_name = ::Regexp.last_match(1)
1441
1449
  puppet_install_version = "~> #{::Regexp.last_match(2)}"
@@ -1453,18 +1461,18 @@ module Simp::BeakerHelpers
1453
1461
  {
1454
1462
  puppet_install_version: puppet_agent_version,
1455
1463
  puppet_collection: puppet_collection,
1456
- puppet_install_type: ENV.fetch('PUPPET_INSTALL_TYPE', 'agent')
1464
+ puppet_install_type: ENV['OPENVOX_INSTALL_TYPE'] || ENV.fetch('PUPPET_INSTALL_TYPE', 'agent')
1457
1465
  }
1458
1466
  end
1459
1467
 
1460
1468
  def run_puppet_install_helper_on(hosts)
1461
1469
  block_on hosts, run_in_parallel: true do |host|
1462
- puppet_collection = ENV.fetch('BEAKER_PUPPET_COLLECTION', nil) || host.options['puppet_collection']
1470
+ puppet_collection = ENV['BEAKER_OPENVOX_COLLECTION'] || ENV.fetch('BEAKER_PUPPET_COLLECTION', nil) || host.options['puppet_collection']
1463
1471
  if is_windows?(host)
1464
1472
  install_msi_on(host, puppet_collection)
1465
1473
  else
1466
1474
  BeakerPuppetHelpers::InstallUtils.install_puppet_release_repo_on(host, puppet_collection)
1467
- package_name = ENV.fetch('BEAKER_PUPPET_PACKAGE_NAME', BeakerPuppetHelpers::InstallUtils.collection2packagename(host, puppet_collection))
1475
+ package_name = ENV['BEAKER_OPENVOX_PACKAGE_NAME'] || ENV.fetch('BEAKER_PUPPET_PACKAGE_NAME', BeakerPuppetHelpers::InstallUtils.collection2packagename(host, puppet_collection))
1468
1476
  host.install_package(package_name)
1469
1477
  end
1470
1478
  end
@@ -4,15 +4,15 @@ require 'rake/tasklib'
4
4
  require 'fileutils'
5
5
  require 'beaker/tasks/rake_task'
6
6
  require 'beaker-rspec/rake_task'
7
- require 'puppetlabs_spec_helper/tasks/fixtures'
7
+ require 'puppet_fixtures/tasks'
8
8
 
9
9
  # Simp namespace
10
10
  module Simp; end
11
11
  # Simp::Rake namespace
12
- module Simp::Rake; end
12
+ module Simp::Rake; end # rubocop:disable Style/OneClassPerFile
13
13
 
14
14
  # Rake tasks for SIMP Beaker testing
15
- class Simp::Rake::Beaker < ::Rake::TaskLib
15
+ class Simp::Rake::Beaker < ::Rake::TaskLib # rubocop:disable Style/OneClassPerFile
16
16
  def initialize(base_dir) # rubocop:disable Lint/MissingSuper
17
17
  @base_dir = base_dir
18
18
  @clean_list = []
@@ -111,7 +111,7 @@ class Simp::Rake::Beaker < ::Rake::TaskLib
111
111
  'default_run' : <true|false> => Default: false
112
112
  ```
113
113
  EOM
114
- task :suites, [:suite, :nodeset] => ['spec_prep'] do |_t, args|
114
+ task :suites, [:suite, :nodeset] => ['fixtures:prep'] do |_t, args|
115
115
  suite = args[:suite]
116
116
  nodeset = args[:nodeset]
117
117
 
data/renovate.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": [
4
- "config:recommended"
4
+ "config:recommended",
5
+ "github>simp/renovate-config",
6
+ "github>simp/renovate-config:ruby.json"
5
7
  ]
6
8
  }
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_runtime_dependency 'docker-api', ['>= 2.1.0', '< 3.0.0']
31
31
  s.add_runtime_dependency 'highline', ['>= 2.0', '< 4.0.0']
32
32
  s.add_runtime_dependency 'nokogiri', '~> 1.8'
33
+ s.add_runtime_dependency 'puppet_fixtures', ['>= 0.1', '< 3.0.0']
33
34
 
34
35
  ### s.files = Dir['Rakefile', '{bin,lib,spec}/**/*', 'README*', 'LICENSE*'] & `git ls-files -z .`.split("\0")
35
36
  s.files = %x(git ls-files).split("\n")
@@ -1,19 +1,25 @@
1
1
  require 'spec_helper_acceptance'
2
2
 
3
- unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
4
- raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
5
- end
3
+ def target_version
4
+ return @target_version if @target_version
5
+
6
+ unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
7
+ raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
8
+ end
9
+
10
+ if ENV['BEAKER_PUPPET_COLLECTION']
11
+ @target_version = ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
12
+ elsif ENV['PUPPET_VERSION']
13
+ @target_version = ENV['PUPPET_VERSION'].split('.').first
14
+ end
6
15
 
7
- if ENV['BEAKER_PUPPET_COLLECTION']
8
- target_version = ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
9
- elsif ENV['PUPPET_VERSION']
10
- target_version = ENV['PUPPET_VERSION'].split('.').first
16
+ @target_version
11
17
  end
12
18
 
13
19
  hosts.each do |host|
14
20
  describe 'make sure puppet version is valid' do
15
21
  context "on #{host}" do
16
- client_puppet_version = on(host, 'puppet --version').output.lines.last.strip
22
+ let(:client_puppet_version) { on(host, 'puppet --version').output.lines.last.strip }
17
23
 
18
24
  it "is running puppet version #{target_version}" do
19
25
  expect(Gem::Version.new(client_puppet_version)).to be >= Gem::Version.new(target_version)
@@ -32,7 +32,7 @@ context 'after copy_fixture_modules_to( hosts )' do
32
32
  end
33
33
 
34
34
  describe "pfact_on(default,'fips_enabled')" do
35
- expected = (ENV['BEAKER_fips'] == 'yes')
35
+ let(:expected) { ENV['BEAKER_fips'] == 'yes' }
36
36
 
37
37
  it 'returns false' do
38
38
  expect(pfact_on(default, 'fips_enabled')).to eq expected
@@ -1,11 +1,14 @@
1
1
  require 'spec_helper_acceptance'
2
2
 
3
- hosts.each do |host|
4
- expect_failures = false
5
- if hosts_with_role(hosts, 'el9').include?(host)
6
- expect_failures = true
7
- end
3
+ def expect_failures?(host)
4
+ os = fact_on(host, 'os')
5
+
6
+ return true if os['family'] == 'RedHat' && os['release']['major'].to_i >= 9
8
7
 
8
+ false
9
+ end
10
+
11
+ hosts.each do |host|
9
12
  describe '#install_simp_repos' do
10
13
  it 'installs yum utils' do
11
14
  host.install_package('yum-utils')
@@ -15,12 +18,12 @@ hosts.each do |host|
15
18
  before(:all) do
16
19
  install_simp_repos(host)
17
20
  rescue => e
18
- raise e unless expect_failures
21
+ raise e unless expect_failures?(host)
19
22
  warn e.message
20
23
  end
21
24
 
22
25
  it 'enables the correct repos' do
23
- skip "#{host} is not supported yet" if expect_failures
26
+ skip "#{host} is not supported yet" if expect_failures?(host)
24
27
  on(host, 'yum -y list simp')
25
28
  on(host, 'yum -y list postgresql96')
26
29
  end
@@ -33,7 +36,7 @@ hosts.each do |host|
33
36
  end
34
37
 
35
38
  it 'lists the simp rpm' do
36
- skip "#{host} is not supported yet" if expect_failures
39
+ skip "#{host} is not supported yet" if expect_failures?(host)
37
40
  on(host, 'yum list simp')
38
41
  end
39
42
  end
@@ -42,12 +45,12 @@ hosts.each do |host|
42
45
  before(:all) do
43
46
  install_simp_repos(host, ['simp-community-simp'])
44
47
  rescue => e
45
- raise e unless expect_failures
48
+ raise e unless expect_failures?(host)
46
49
  warn e.message
47
50
  end
48
51
 
49
52
  it 'enables the correct repos' do
50
- skip "#{host} is not supported yet" if expect_failures
53
+ skip "#{host} is not supported yet" if expect_failures?(host)
51
54
  on(host, 'yum -y list postgresql96')
52
55
  end
53
56
 
@@ -24,8 +24,13 @@ context 'PKI operations' do
24
24
  end
25
25
 
26
26
  describe 'a Fake CA under /root' do
27
- tmp_keydist_dir = Dir.mktmpdir 'simp-beaker-helpers__pki-tests'
28
- run_fake_pki_ca_on(default, hosts, tmp_keydist_dir)
27
+ def tmp_keydist_dir
28
+ @tmp_keydist_dir ||= Dir.mktmpdir 'simp-beaker-helpers__pki-tests'
29
+ end
30
+
31
+ before(:all) do
32
+ run_fake_pki_ca_on(default, hosts, tmp_keydist_dir)
33
+ end
29
34
 
30
35
  it 'creates /root/pki' do
31
36
  on(default, 'test -d /root/pki')
@@ -35,15 +40,19 @@ context 'PKI operations' do
35
40
  end
36
41
 
37
42
  describe 'after copy_keydist_to' do
38
- test_dir = '/etc/puppetlabs/code/environments/production/modules/pki/files/keydist'
39
- copy_keydist_to(default)
40
- it_behaves_like 'a correctly copied keydist/ tree', test_dir
43
+ before(:all) do
44
+ copy_keydist_to(default)
45
+ end
46
+
47
+ it_behaves_like 'a correctly copied keydist/ tree', '/etc/puppetlabs/code/environments/production/modules/pki/files/keydist'
41
48
  end
42
49
 
43
- describe 'after copy_keydist_to(default,"/tmp/foo")' do
44
- test_dir = '/tmp/foo'
45
- copy_keydist_to(default, test_dir)
46
- it_behaves_like 'a correctly copied keydist/ tree', test_dir
50
+ describe 'after copy_keydist_to(default, "/tmp/foo")' do
51
+ before(:all) do
52
+ copy_keydist_to(default, '/tmp/foo')
53
+ end
54
+
55
+ it_behaves_like 'a correctly copied keydist/ tree', '/tmp/foo'
47
56
  end
48
57
  end
49
58
  end
@@ -10,7 +10,11 @@ end
10
10
  require 'yaml'
11
11
  require 'tempfile'
12
12
 
13
- alt_fixtures = File.absolute_path('.fips_fixtures.yml')
13
+ def alt_fixtures
14
+ return @alt_fixtures if @alt_fixtures
15
+
16
+ @alt_fixtures = File.absolute_path('.fips_fixtures.yml')
17
+ end
14
18
 
15
19
  new_fixtures = {
16
20
  'fixtures' => {
@@ -38,7 +38,7 @@ describe 'Inspec STIG Profile' do
38
38
 
39
39
  it 'has a report' do
40
40
  expect(inspec_report_data[:report]).not_to be_nil
41
- puts inspec_report_data[:report]
41
+ puts inspec_report_data[:report] # rubocop:disable RSpec/Output
42
42
  end
43
43
  else
44
44
  # rubocop:disable RSpec/RepeatedDescription
@@ -1,19 +1,21 @@
1
1
  require 'spec_helper_acceptance'
2
2
 
3
- unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
4
- raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
5
- end
3
+ def target_version
4
+ unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
5
+ raise('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
6
+ end
6
7
 
7
- if ENV['BEAKER_PUPPET_COLLECTION']
8
- target_version = ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
9
- elsif ENV['PUPPET_VERSION']
10
- target_version = ENV['PUPPET_VERSION'].split('.').first
8
+ if ENV['BEAKER_PUPPET_COLLECTION']
9
+ ENV['BEAKER_PUPPET_COLLECTION'][%r{(\d+)$}, 1]
10
+ elsif ENV['PUPPET_VERSION']
11
+ ENV['PUPPET_VERSION'].split('.').first
12
+ end
11
13
  end
12
14
 
13
15
  hosts.each do |host|
14
16
  describe 'make sure puppet version is valid' do
15
17
  context "on #{host}" do
16
- client_puppet_version = on(host, 'puppet --version').output.lines.last.strip
18
+ let(:client_puppet_version) { on(host, 'puppet --version').output.lines.last.strip }
17
19
 
18
20
  it "is running puppet version #{target_version}" do
19
21
  expect(Gem::Version.new(client_puppet_version)).to be >= Gem::Version.new(target_version)
@@ -1 +1 @@
1
- spec/fixtures/inspec_profiles/RedHat-7-disa_stig
1
+ RedHat-7-disa_stig