simp-beaker-helpers 3.1.1 → 3.2.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 +4 -4
- data/.fixtures.yml +0 -3
- data/.github/workflows/add_new_issue_to_triage_project.yml +42 -0
- data/.github/workflows/pr_tests.yml +77 -5
- data/.github/workflows/tag_deploy_rubygem.yml +2 -2
- data/CHANGELOG.md +12 -0
- data/Gemfile +3 -3
- data/README.md +7 -6
- data/lib/simp/beaker_helpers/inspec.rb +14 -2
- data/lib/simp/beaker_helpers/version.rb +1 -1
- data/lib/simp/beaker_helpers.rb +1 -1
- data/spec/acceptance/suites/default/fixture_modules_spec.rb +0 -7
- data/spec/acceptance/suites/offline/00_default_spec.rb +2 -4
- data/spec/acceptance/suites/snapshot/00_snapshot_test_spec.rb +10 -20
- data/spec/lib/simp/beaker_helpers_spec.rb +3 -10
- metadata +3 -10
- data/.github/workflows/pr_acceptance.yml +0 -72
- data/spec/acceptance/suites/inspec/00_default_spec.rb +0 -54
- data/spec/acceptance/suites/inspec/metadata.yml +0 -2
- data/spec/acceptance/suites/inspec/nodesets +0 -1
- data/spec/fixtures/inspec_profiles/CentOS-7-disa_stig +0 -1
- data/spec/fixtures/inspec_profiles/RedHat-7-disa_stig/controls/00_Control_Selector.rb +0 -45
- data/spec/fixtures/inspec_profiles/RedHat-7-disa_stig/inspec.yml +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 715fefc3d0f97c9acd754714500ad5b7449bab8ff8cf37143d5c67ffaf23769a
|
|
4
|
+
data.tar.gz: f91cc5e9a932e037889ec0db8380dab0c3a146bb3a00c7724afa086dbab235ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8802f41a286e3ce1e504fe6753a0767575caf74d326d0a33f679c714f9026aa92b9b92ce2146f22547c9ba3fb41033d960eec3c20d0d58ad208df492695b1d17
|
|
7
|
+
data.tar.gz: 4dca280a068b3f74ad4993556215f6131ed3d68ca86ed6f8e36487f62f0872742d7dc371da63d88c8db80a8328a389d963d2dedb8a5bd6e6cbbab99891509770
|
data/.fixtures.yml
CHANGED
|
@@ -4,6 +4,3 @@ fixtures:
|
|
|
4
4
|
stdlib: https://github.com/simp/puppetlabs-stdlib
|
|
5
5
|
simplib: https://github.com/simp/pupmod-simp-simplib
|
|
6
6
|
compliance_markup: https://github.com/simp/pupmod-simp-compliance_markup
|
|
7
|
-
disa_stig-el7-baseline:
|
|
8
|
-
repo: https://github.com/mitre/redhat-enterprise-linux-7-stig-baseline
|
|
9
|
-
target: spec/fixtures/inspec_deps/inspec_profiles/profiles
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
# Add newly opened issues and pull requests to the Org Triage board
|
|
2
|
+
# ------------------------------------------------------------------------------
|
|
3
|
+
# NOTICE: **This file is maintained with puppetsync**
|
|
4
|
+
#
|
|
5
|
+
# This file is updated automatically as part of a puppet module baseline.
|
|
6
|
+
#
|
|
7
|
+
# The next baseline sync will overwrite any local changes to this file!
|
|
8
|
+
#
|
|
9
|
+
# ==============================================================================
|
|
10
|
+
#
|
|
11
|
+
# Board: https://github.com/orgs/simp/projects/11
|
|
12
|
+
#
|
|
13
|
+
# Intake is filtered (simp/puppetsync#97): automated traffic never needs a
|
|
14
|
+
# human to triage it, and letting it in buried the items that do.
|
|
15
|
+
#
|
|
16
|
+
# * Renovate (and Dependabot, pre-emptively) are matched by actor.
|
|
17
|
+
# * puppetsync's own sync PRs are matched by the `[puppetsync]` title prefix.
|
|
18
|
+
# That prefix is a CONVENTION set by the `commit_message` in each sync
|
|
19
|
+
# config, not something enforced -- a config that drops it would silently
|
|
20
|
+
# start adding sync PRs to the board again.
|
|
21
|
+
#
|
|
22
|
+
# PRs in general are deliberately NOT filtered: drive-by PRs from outside
|
|
23
|
+
# contributors are exactly what the board must catch.
|
|
24
|
+
#
|
|
25
|
+
# This workflow does not check out any code, which is what makes its use of
|
|
26
|
+
# `pull_request_target` safe. Keep it that way.
|
|
27
|
+
#
|
|
28
|
+
# Labelling (`community` for outside contributions, `needs-attention` for
|
|
29
|
+
# stalled items) is NOT done here: the event payload's `author_association`
|
|
30
|
+
# reports private org members as CONTRIBUTOR, so a per-repo step would mislabel
|
|
31
|
+
# most of the team. It lives in the scheduled org job
|
|
32
|
+
# simp/gha-workflows/.github/workflows/org_reconcile_board_status.yml, which
|
|
33
|
+
# resolves membership from the org member list (simp/puppetsync#98, #99).
|
|
34
|
+
#
|
|
1
35
|
---
|
|
2
36
|
name: Add new issues to triage project
|
|
3
37
|
|
|
@@ -14,6 +48,14 @@ jobs:
|
|
|
14
48
|
add-to-project:
|
|
15
49
|
name: Add issue to project
|
|
16
50
|
runs-on: ubuntu-latest
|
|
51
|
+
# `github.event.pull_request` is null on `issues` events, so the title test
|
|
52
|
+
# is guarded by event_name rather than relying on startsWith(null, ...)
|
|
53
|
+
# evaluating false.
|
|
54
|
+
if: >-
|
|
55
|
+
github.actor != 'renovate[bot]' &&
|
|
56
|
+
github.actor != 'dependabot[bot]' &&
|
|
57
|
+
!(github.event_name == 'pull_request_target' &&
|
|
58
|
+
startsWith(github.event.pull_request.title, '[puppetsync]'))
|
|
17
59
|
steps:
|
|
18
60
|
- uses: actions/add-to-project@v2
|
|
19
61
|
with:
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
- name: "Install Ruby 3.2"
|
|
37
37
|
uses: ruby/setup-ruby@v1
|
|
38
38
|
with:
|
|
39
|
-
ruby-version: 4.0.
|
|
39
|
+
ruby-version: 4.0.9
|
|
40
40
|
bundler-cache: true
|
|
41
41
|
- run: |
|
|
42
42
|
bundle show
|
|
@@ -52,10 +52,8 @@ jobs:
|
|
|
52
52
|
puppet_version: '~> 8.0'
|
|
53
53
|
ruby_version: '3.2'
|
|
54
54
|
experimental: false
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- label: 'OpenVox 9.x preview (Ruby 4.0, OpenVox 8 gem)'
|
|
58
|
-
puppet_version: '~> 8.0'
|
|
55
|
+
- label: 'OpenVox 9.x (Ruby 4.0)'
|
|
56
|
+
puppet_version: '~> 9.0'
|
|
59
57
|
ruby_version: '4.0'
|
|
60
58
|
experimental: false
|
|
61
59
|
env:
|
|
@@ -71,6 +69,80 @@ jobs:
|
|
|
71
69
|
- run: 'bundle exec rake spec'
|
|
72
70
|
continue-on-error: ${{matrix.puppet.experimental}}
|
|
73
71
|
|
|
72
|
+
acceptance:
|
|
73
|
+
name: '${{matrix.beaker.suite}}, ${{matrix.puppet.label}}'
|
|
74
|
+
runs-on:
|
|
75
|
+
- ubuntu-latest
|
|
76
|
+
strategy:
|
|
77
|
+
matrix:
|
|
78
|
+
puppet:
|
|
79
|
+
- label: 'OpenVox 8.x'
|
|
80
|
+
puppet_version: '~> 8.0'
|
|
81
|
+
ruby_version: '3.2'
|
|
82
|
+
collection: 'openvox8'
|
|
83
|
+
experimental: false
|
|
84
|
+
beaker:
|
|
85
|
+
- label: beaker
|
|
86
|
+
suite: default
|
|
87
|
+
allowed_to_fail: false
|
|
88
|
+
- label: beaker puppet_collections
|
|
89
|
+
suite: puppet_collections
|
|
90
|
+
allowed_to_fail: false
|
|
91
|
+
fail-fast: false
|
|
92
|
+
env:
|
|
93
|
+
PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
|
|
94
|
+
steps:
|
|
95
|
+
- name: checkout repo
|
|
96
|
+
uses: actions/checkout@v7
|
|
97
|
+
- name: setup ruby
|
|
98
|
+
uses: ruby/setup-ruby@v1
|
|
99
|
+
with:
|
|
100
|
+
ruby-version: ${{ matrix.puppet.ruby_version }}
|
|
101
|
+
- name: ensure entropy
|
|
102
|
+
run: |
|
|
103
|
+
sudo apt-get update -y
|
|
104
|
+
sudo apt-get install -y rng-tools
|
|
105
|
+
sudo systemctl start rng-tools
|
|
106
|
+
- name: install docker
|
|
107
|
+
run: |
|
|
108
|
+
set -x
|
|
109
|
+
sudo apt-get remove -y podman ||:
|
|
110
|
+
sudo apt-get install -y docker-ce docker docker-engine docker.io containerd runc ||:
|
|
111
|
+
sudo apt-get update
|
|
112
|
+
sudo apt autoremove -y
|
|
113
|
+
sudo systemctl start docker
|
|
114
|
+
- name: install bundle
|
|
115
|
+
run: |
|
|
116
|
+
bundle config path vendor
|
|
117
|
+
bundle install -j $(nproc)
|
|
118
|
+
- name: set BEAKER_PUPPET_COLLECTION
|
|
119
|
+
if: ${{matrix.puppet.collection}}
|
|
120
|
+
run: echo "BEAKER_PUPPET_COLLECTION=${{matrix.puppet.collection}}" >> $GITHUB_ENV
|
|
121
|
+
- name: 'run beaker:suite "${{matrix.beaker.label}}"'
|
|
122
|
+
continue-on-error: ${{matrix.puppet.experimental || matrix.beaker.allowed_to_fail}}
|
|
123
|
+
env:
|
|
124
|
+
BEAKER_SUITE: ${{matrix.beaker.suite}}
|
|
125
|
+
run: bundle exec rake beaker:suites[$BEAKER_SUITE,docker]
|
|
126
|
+
|
|
127
|
+
# The one check for branch protection to require: GitHub only blocks a
|
|
128
|
+
# merge on checks listed by name, and this job fails unless every job it
|
|
129
|
+
# needs succeeded. Add any new job in this workflow to `needs:`.
|
|
130
|
+
all-checks:
|
|
131
|
+
name: 'All checks'
|
|
132
|
+
if: always()
|
|
133
|
+
needs:
|
|
134
|
+
- ruby-style
|
|
135
|
+
- spec-tests
|
|
136
|
+
- acceptance
|
|
137
|
+
runs-on: ubuntu-latest
|
|
138
|
+
steps:
|
|
139
|
+
- name: 'Fail unless every needed job succeeded'
|
|
140
|
+
env:
|
|
141
|
+
NEEDS: ${{ toJSON(needs) }}
|
|
142
|
+
run: |
|
|
143
|
+
jq -r 'to_entries[] | "\(.key): \(.value.result)"' <<< "$NEEDS"
|
|
144
|
+
jq -e 'all(.[]; .result == "success")' <<< "$NEEDS" > /dev/null
|
|
145
|
+
|
|
74
146
|
# dump_contexts:
|
|
75
147
|
# name: 'Examine Context contents'
|
|
76
148
|
# runs-on: ubuntu-latest
|
|
@@ -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: 4.0.
|
|
95
|
+
ruby-version: 4.0.9
|
|
96
96
|
bundler-cache: true
|
|
97
97
|
- name: Test build the package
|
|
98
98
|
run: "${{ steps.commands.outputs.build_command }}"
|
|
@@ -184,7 +184,7 @@ jobs:
|
|
|
184
184
|
clean: true
|
|
185
185
|
- uses: ruby/setup-ruby@v1
|
|
186
186
|
with:
|
|
187
|
-
ruby-version: 4.0.
|
|
187
|
+
ruby-version: 4.0.9
|
|
188
188
|
bundler-cache: true
|
|
189
189
|
- name: Build RubyGem
|
|
190
190
|
run: |
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
### 3.2.0 / 2026-11-13
|
|
2
|
+
* Added:
|
|
3
|
+
* Tested with OpenVox 9 (the gem itself does not constrain the openvox
|
|
4
|
+
version)
|
|
5
|
+
* Deprecated:
|
|
6
|
+
* `Simp::BeakerHelpers::Inspec` now warns when used and will be removed in
|
|
7
|
+
the next major release
|
|
8
|
+
|
|
9
|
+
### 3.1.2 / 2026-09-29
|
|
10
|
+
* Fixed:
|
|
11
|
+
* Minor changes for rubocop 1.91
|
|
12
|
+
|
|
1
13
|
### 3.1.1 / 2026-07-03
|
|
2
14
|
* Fixed:
|
|
3
15
|
* `run_fake_pki_ca_on` now runs `ensure_beaker_ip_on` before collecting
|
data/Gemfile
CHANGED
|
@@ -41,14 +41,14 @@ group :system_tests do
|
|
|
41
41
|
gem 'ed25519'
|
|
42
42
|
gem 'net-ssh'
|
|
43
43
|
# renovate: datasource=rubygems versioning=ruby
|
|
44
|
-
gem 'openvox', ENV.fetch('OPENVOX_VERSION', ENV.fetch('PUPPET_VERSION', ['>= 8.0.0', '<
|
|
44
|
+
gem 'openvox', ENV.fetch('OPENVOX_VERSION', ENV.fetch('PUPPET_VERSION', ['>= 8.0.0', '< 10.0.0']))
|
|
45
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.
|
|
51
|
-
gem 'rubocop-performance', '~> 1.
|
|
50
|
+
gem 'rubocop', '~> 1.92.0'
|
|
51
|
+
gem 'rubocop-performance', '~> 1.27.0'
|
|
52
52
|
gem 'rubocop-rake', '~> 0.7.0'
|
|
53
53
|
gem 'rubocop-rspec', '~> 3.10.0'
|
|
54
54
|
end
|
data/README.md
CHANGED
|
@@ -262,8 +262,8 @@ copy_fixture_modules_to( suts = hosts, opts = {} )
|
|
|
262
262
|
- **`opts`** = _(Hash)_ Options passed on to `copy_module_to()` for each SUT
|
|
263
263
|
|
|
264
264
|
By default, this will copy modules to the first path listed in each SUT's
|
|
265
|
-
`modulepath` and simulate a pluginsync
|
|
266
|
-
|
|
265
|
+
`modulepath` and simulate a pluginsync, which copies the modules' plugins (such
|
|
266
|
+
as custom facts) into each SUT's `libdir`.
|
|
267
267
|
|
|
268
268
|
If you need to use a non-default module path:
|
|
269
269
|
```ruby
|
|
@@ -275,7 +275,7 @@ copy_fixture_modules_to( hosts, {
|
|
|
275
275
|
|
|
276
276
|
If you want to disable pluginsync:
|
|
277
277
|
```ruby
|
|
278
|
-
#
|
|
278
|
+
# `fact_on` and `pfact_on` still see the copied modules' facts
|
|
279
279
|
copy_fixture_modules_to( hosts, {
|
|
280
280
|
:pluginsync => false
|
|
281
281
|
})
|
|
@@ -462,10 +462,11 @@ might try to install packages before subscription manager is configured.
|
|
|
462
462
|
|
|
463
463
|
#### BEAKER_inspec_version
|
|
464
464
|
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
**Deprecated:** `Simp::BeakerHelpers::Inspec` will be removed in the next
|
|
466
|
+
major release.
|
|
467
467
|
|
|
468
|
-
|
|
468
|
+
The version of InSpec that `Simp::BeakerHelpers::Inspec` installs. Defaults to
|
|
469
|
+
`latest`, the newest version in the upstream repos.
|
|
469
470
|
|
|
470
471
|
#### BEAKER_RHSM_UNSUBSCRIBE
|
|
471
472
|
|
|
@@ -3,14 +3,26 @@ module Simp::BeakerHelpers
|
|
|
3
3
|
require 'simp/beaker_helpers/constants'
|
|
4
4
|
|
|
5
5
|
# Helpers for working with Inspec
|
|
6
|
+
#
|
|
7
|
+
# @deprecated Will be removed in the next major release.
|
|
6
8
|
class Inspec
|
|
7
9
|
require 'json'
|
|
8
10
|
|
|
11
|
+
# Warn once per process that this helper is deprecated
|
|
12
|
+
def self.deprecation_warning
|
|
13
|
+
return if @deprecation_warned
|
|
14
|
+
|
|
15
|
+
warn('DEPRECATION: Simp::BeakerHelpers::Inspec is deprecated and will be removed in the next major release of simp-beaker-helpers')
|
|
16
|
+
@deprecation_warned = true
|
|
17
|
+
end
|
|
18
|
+
|
|
9
19
|
attr_reader :profile
|
|
10
20
|
attr_reader :profile_dir
|
|
11
21
|
attr_reader :deps_root
|
|
12
22
|
|
|
13
23
|
def self.enable_repo_on(suts)
|
|
24
|
+
deprecation_warning
|
|
25
|
+
|
|
14
26
|
parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
|
|
15
27
|
block_on(suts, run_in_parallel: parallel) do |sut|
|
|
16
28
|
repo_manifest = create_yum_resource(
|
|
@@ -34,6 +46,8 @@ module Simp::BeakerHelpers
|
|
|
34
46
|
# The name of the profile against which to run
|
|
35
47
|
#
|
|
36
48
|
def initialize(sut, profile)
|
|
49
|
+
self.class.deprecation_warning
|
|
50
|
+
|
|
37
51
|
@inspec_version = ENV['BEAKER_inspec_version'] || 'latest'
|
|
38
52
|
|
|
39
53
|
@sut = sut
|
|
@@ -240,12 +254,10 @@ module Simp::BeakerHelpers
|
|
|
240
254
|
|
|
241
255
|
if control['results'] && !control['results'].empty?
|
|
242
256
|
status = :passed
|
|
243
|
-
color = 'green'
|
|
244
257
|
|
|
245
258
|
control['results'].each do |_result|
|
|
246
259
|
if %r{^fail}.match?(results['status'])
|
|
247
260
|
status = :failed
|
|
248
|
-
color = 'red'
|
|
249
261
|
end
|
|
250
262
|
end
|
|
251
263
|
|
data/lib/simp/beaker_helpers.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Simp::BeakerHelpers # rubocop:disable Style/OneClassPerFile
|
|
|
24
24
|
|
|
25
25
|
# Stealing this from the Ruby 2.5 Dir::Tmpname workaround from Rails
|
|
26
26
|
def self.tmpname
|
|
27
|
-
t = Time.
|
|
27
|
+
t = Time.now.strftime('%Y%m%d')
|
|
28
28
|
"simp-beaker-helpers-#{t}-#{$PROCESS_ID}-#{rand(0x100000000).to_s(36)}.tmp"
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -6,13 +6,6 @@ context 'after copy_fixture_modules_to( hosts )' do
|
|
|
6
6
|
copy_fixture_modules_to(hosts)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
describe "fact_on(default,'root_home')" do
|
|
10
|
-
# fact_on in beaker_puppet_helpers is equivalent to pfact_on
|
|
11
|
-
xit 'does not return value of `root_home`' do
|
|
12
|
-
expect(fact_on(default, 'root_home').to_s).to eq ''
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
9
|
describe "pfact_on(default,'root_home')" do
|
|
17
10
|
it 'returns value of `root_home`' do
|
|
18
11
|
expect(pfact_on(default, 'root_home')).to eq '/root'
|
|
@@ -175,22 +175,20 @@ describe 'Offline mode' do
|
|
|
175
175
|
on(host, %(#{build_user_cmd} "cd pupmod-simp-at; bundle update"))
|
|
176
176
|
end
|
|
177
177
|
|
|
178
|
-
# rubocop:disable RSpec/RepeatedExample
|
|
178
|
+
# rubocop:disable-next RSpec/RepeatedExample
|
|
179
179
|
it 'runs a network-connected test' do
|
|
180
180
|
on(host, %(#{build_user_cmd} "cd pupmod-simp-at; rake beaker:suites"))
|
|
181
181
|
end
|
|
182
|
-
# rubocop:enable RSpec/RepeatedExample
|
|
183
182
|
|
|
184
183
|
it 'disables all internet network traffic via iptables' do
|
|
185
184
|
on(host, %(iptables -I OUTPUT -d `ip route | awk '/default/ {print $3}'`/16 -j ACCEPT))
|
|
186
185
|
on(host, 'iptables -A OUTPUT -j DROP')
|
|
187
186
|
end
|
|
188
187
|
|
|
189
|
-
# rubocop:disable RSpec/RepeatedExample
|
|
188
|
+
# rubocop:disable-next RSpec/RepeatedExample
|
|
190
189
|
xit 'runs a network-disconnected test' do
|
|
191
190
|
on(host, %(#{build_user_cmd} "cd pupmod-simp-at; rake beaker:suites"))
|
|
192
191
|
end
|
|
193
|
-
# rubocop:enable RSpec/RepeatedExample
|
|
194
192
|
end
|
|
195
193
|
end
|
|
196
194
|
end
|
|
@@ -3,72 +3,63 @@ require 'spec_helper_acceptance'
|
|
|
3
3
|
hosts.each do |host|
|
|
4
4
|
describe 'take a snapshot' do
|
|
5
5
|
context "on #{host}" do
|
|
6
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
6
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
7
7
|
it 'creates a file that should be saved' do
|
|
8
8
|
on(host, 'echo "keep" > /root/keep')
|
|
9
9
|
end
|
|
10
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
11
10
|
|
|
12
|
-
# rubocop:disable RSpec/RepeatedExample
|
|
11
|
+
# rubocop:disable-next RSpec/RepeatedExample
|
|
13
12
|
it 'takes a snapshot' do
|
|
14
13
|
Simp::BeakerHelpers::Snapshot.save(host, 'test')
|
|
15
14
|
end
|
|
16
|
-
# rubocop:enable RSpec/RepeatedExample
|
|
17
15
|
|
|
18
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
16
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
19
17
|
it 'creates a file that should be removed' do
|
|
20
18
|
on(host, 'echo "trash" > /root/trash')
|
|
21
19
|
end
|
|
22
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
23
20
|
|
|
24
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
21
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
25
22
|
it 'restores a snapshot' do
|
|
26
23
|
Simp::BeakerHelpers::Snapshot.restore(host, 'test')
|
|
27
24
|
end
|
|
28
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
29
25
|
|
|
30
26
|
it 'has the keep file' do
|
|
31
27
|
expect(host.file_exist?('/root/keep')).to be true
|
|
32
28
|
end
|
|
33
29
|
|
|
34
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
30
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
35
31
|
it 'does not have the trash file' do
|
|
36
32
|
expect(host.file_exist?('/root/trash')).to be false
|
|
37
33
|
end
|
|
38
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
39
34
|
|
|
40
35
|
it 'creates a second file that should be saved' do
|
|
41
36
|
on(host, 'echo "keep2" > /root/keep2')
|
|
42
37
|
end
|
|
43
38
|
|
|
44
|
-
# rubocop:disable RSpec/RepeatedExample
|
|
39
|
+
# rubocop:disable-next RSpec/RepeatedExample
|
|
45
40
|
it 'takes a snapshot with the same name' do
|
|
46
41
|
Simp::BeakerHelpers::Snapshot.save(host, 'test')
|
|
47
42
|
end
|
|
48
|
-
# rubocop:enable RSpec/RepeatedExample
|
|
49
43
|
|
|
50
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
44
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
51
45
|
it 'creates a file that should be removed' do
|
|
52
46
|
on(host, 'echo "trash" > /root/trash')
|
|
53
47
|
end
|
|
54
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
55
48
|
|
|
56
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
49
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
57
50
|
it 'restores a snapshot' do
|
|
58
51
|
Simp::BeakerHelpers::Snapshot.restore(host, 'test')
|
|
59
52
|
end
|
|
60
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
61
53
|
|
|
62
54
|
it 'has all keep files' do
|
|
63
55
|
expect(host.file_exist?('/root/keep')).to be true
|
|
64
56
|
expect(host.file_exist?('/root/keep2')).to be true
|
|
65
57
|
end
|
|
66
58
|
|
|
67
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
59
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
68
60
|
it 'does not have the trash file' do
|
|
69
61
|
expect(host.file_exist?('/root/trash')).to be false
|
|
70
62
|
end
|
|
71
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
72
63
|
|
|
73
64
|
it 'takes a snapshot with a different name' do
|
|
74
65
|
Simp::BeakerHelpers::Snapshot.save(host, 'test2')
|
|
@@ -88,11 +79,10 @@ hosts.each do |host|
|
|
|
88
79
|
Simp::BeakerHelpers::Snapshot.restore_to_base(host)
|
|
89
80
|
end
|
|
90
81
|
|
|
91
|
-
# rubocop:disable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
82
|
+
# rubocop:disable-next RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
92
83
|
it 'creates a file that should be saved' do
|
|
93
84
|
on(host, 'echo "keep" > /root/keep')
|
|
94
85
|
end
|
|
95
|
-
# rubocop:enable RSpec/RepeatedExample, RSpec/RepeatedDescription
|
|
96
86
|
|
|
97
87
|
it 'creates a handoff snapshot for further tests' do
|
|
98
88
|
Simp::BeakerHelpers::Snapshot.save(host, 'handoff')
|
|
@@ -145,16 +145,9 @@ describe 'Simp::BeakerHelpers' do
|
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
it 'uses defaults when no environment variables are set' do
|
|
148
|
-
#
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
pipe_out.close
|
|
152
|
-
require 'puppet'
|
|
153
|
-
pipe_in.write(Puppet.version)
|
|
154
|
-
end
|
|
155
|
-
pipe_in.close
|
|
156
|
-
|
|
157
|
-
expected_major_version = pipe_out.gets.split('.').first
|
|
148
|
+
# The default collection follows DEFAULT_PUPPET_AGENT_VERSION, not the
|
|
149
|
+
# openvox gem the test suite happens to be running under
|
|
150
|
+
expected_major_version = Simp::BeakerHelpers::DEFAULT_PUPPET_AGENT_VERSION[%r{\d+}]
|
|
158
151
|
|
|
159
152
|
expect(helper.get_puppet_install_info[:puppet_collection]).to eq("puppet#{expected_major_version}")
|
|
160
153
|
expect(helper.get_puppet_install_info[:puppet_install_type]).to eq('agent')
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simp-beaker-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Tessmer
|
|
8
8
|
- Trevor Vaughan
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: beaker
|
|
@@ -196,7 +196,6 @@ files:
|
|
|
196
196
|
- ".fixtures.yml"
|
|
197
197
|
- ".github/workflows.local.json"
|
|
198
198
|
- ".github/workflows/add_new_issue_to_triage_project.yml"
|
|
199
|
-
- ".github/workflows/pr_acceptance.yml"
|
|
200
199
|
- ".github/workflows/pr_tests.yml"
|
|
201
200
|
- ".github/workflows/tag_deploy_rubygem.yml"
|
|
202
201
|
- ".gitignore"
|
|
@@ -237,9 +236,6 @@ files:
|
|
|
237
236
|
- spec/acceptance/suites/fips_from_fixtures/00_default_spec.rb
|
|
238
237
|
- spec/acceptance/suites/fips_from_fixtures/metadata.yml
|
|
239
238
|
- spec/acceptance/suites/fips_from_fixtures/nodesets
|
|
240
|
-
- spec/acceptance/suites/inspec/00_default_spec.rb
|
|
241
|
-
- spec/acceptance/suites/inspec/metadata.yml
|
|
242
|
-
- spec/acceptance/suites/inspec/nodesets
|
|
243
239
|
- spec/acceptance/suites/offline/00_default_spec.rb
|
|
244
240
|
- spec/acceptance/suites/offline/README
|
|
245
241
|
- spec/acceptance/suites/offline/nodesets/default.yml
|
|
@@ -254,9 +250,6 @@ files:
|
|
|
254
250
|
- spec/acceptance/suites/windows/nodesets/win2012.yml
|
|
255
251
|
- spec/acceptance/suites/windows/nodesets/win2016.yml
|
|
256
252
|
- spec/acceptance/suites/windows/nodesets/win2019.yml
|
|
257
|
-
- spec/fixtures/inspec_profiles/CentOS-7-disa_stig
|
|
258
|
-
- spec/fixtures/inspec_profiles/RedHat-7-disa_stig/controls/00_Control_Selector.rb
|
|
259
|
-
- spec/fixtures/inspec_profiles/RedHat-7-disa_stig/inspec.yml
|
|
260
253
|
- spec/lib/simp/beaker_helpers_spec.rb
|
|
261
254
|
- spec/spec_helper.rb
|
|
262
255
|
- spec/spec_helper_acceptance.rb
|
|
@@ -279,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
279
272
|
- !ruby/object:Gem::Version
|
|
280
273
|
version: '0'
|
|
281
274
|
requirements: []
|
|
282
|
-
rubygems_version: 4.0.
|
|
275
|
+
rubygems_version: 4.0.20
|
|
283
276
|
specification_version: 4
|
|
284
277
|
summary: beaker helper methods for SIMP
|
|
285
278
|
test_files: []
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Run all tests as GitHub Actions
|
|
2
|
-
---
|
|
3
|
-
name: Acceptance Tests
|
|
4
|
-
'on':
|
|
5
|
-
push:
|
|
6
|
-
branches:
|
|
7
|
-
# A test branch for seeing if your tests will pass in your personal fork
|
|
8
|
-
- test_me_github
|
|
9
|
-
pull_request:
|
|
10
|
-
types: [opened, reopened, synchronize]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
acceptance:
|
|
14
|
-
name: '${{matrix.beaker.suite}}, ${{matrix.puppet.label}}'
|
|
15
|
-
runs-on:
|
|
16
|
-
- ubuntu-latest
|
|
17
|
-
strategy:
|
|
18
|
-
matrix:
|
|
19
|
-
puppet:
|
|
20
|
-
- label: 'OpenVox 8.x'
|
|
21
|
-
puppet_version: '~> 8.0'
|
|
22
|
-
ruby_version: '3.2'
|
|
23
|
-
collection: 'openvox8'
|
|
24
|
-
experimental: false
|
|
25
|
-
beaker:
|
|
26
|
-
- label: beaker
|
|
27
|
-
suite: default
|
|
28
|
-
allowed_to_fail: false
|
|
29
|
-
- label: beaker puppet_collections
|
|
30
|
-
suite: puppet_collections
|
|
31
|
-
allowed_to_fail: false
|
|
32
|
-
# The inspec suite fails for unclear reasons during an scp.
|
|
33
|
-
# Sicura tests compliance at the framework level, so troubleshooting
|
|
34
|
-
# inspec acceptance tests is not a priority at present.
|
|
35
|
-
- label: beaker inspec
|
|
36
|
-
suite: inspec
|
|
37
|
-
allowed_to_fail: true
|
|
38
|
-
fail-fast: false
|
|
39
|
-
env:
|
|
40
|
-
PUPPET_VERSION: ${{matrix.puppet.puppet_version}}
|
|
41
|
-
steps:
|
|
42
|
-
- name: checkout repo
|
|
43
|
-
uses: actions/checkout@v7
|
|
44
|
-
- name: setup ruby
|
|
45
|
-
uses: ruby/setup-ruby@v1
|
|
46
|
-
with:
|
|
47
|
-
ruby-version: ${{ matrix.puppet.ruby_version }}
|
|
48
|
-
- name: ensure entropy
|
|
49
|
-
run: |
|
|
50
|
-
sudo apt-get update -y
|
|
51
|
-
sudo apt-get install -y rng-tools
|
|
52
|
-
sudo systemctl start rng-tools
|
|
53
|
-
- name: install docker
|
|
54
|
-
run: |
|
|
55
|
-
set -x
|
|
56
|
-
sudo apt-get remove -y podman ||:
|
|
57
|
-
sudo apt-get install -y docker-ce docker docker-engine docker.io containerd runc ||:
|
|
58
|
-
sudo apt-get update
|
|
59
|
-
sudo apt autoremove -y
|
|
60
|
-
sudo systemctl start docker
|
|
61
|
-
- name: install bundle
|
|
62
|
-
run: |
|
|
63
|
-
bundle config path vendor
|
|
64
|
-
bundle install -j $(nproc)
|
|
65
|
-
- name: set BEAKER_PUPPET_COLLECTION
|
|
66
|
-
if: ${{matrix.puppet.collection}}
|
|
67
|
-
run: echo "BEAKER_PUPPET_COLLECTION=${{matrix.puppet.collection}}" >> $GITHUB_ENV
|
|
68
|
-
- name: 'run beaker:suite "${{matrix.beaker.label}}"'
|
|
69
|
-
continue-on-error: ${{matrix.puppet.experimental || matrix.beaker.allowed_to_fail}}
|
|
70
|
-
env:
|
|
71
|
-
BEAKER_SUITE: ${{matrix.beaker.suite}}
|
|
72
|
-
run: bundle exec rake beaker:suites[$BEAKER_SUITE,docker]
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require 'spec_helper_acceptance'
|
|
2
|
-
require 'json'
|
|
3
|
-
|
|
4
|
-
test_name 'Inspec STIG Profile'
|
|
5
|
-
|
|
6
|
-
describe 'Inspec STIG Profile' do
|
|
7
|
-
profiles_to_validate = ['disa_stig']
|
|
8
|
-
|
|
9
|
-
hosts.each do |host|
|
|
10
|
-
profiles_to_validate.each do |profile|
|
|
11
|
-
context "for profile #{profile}" do
|
|
12
|
-
context "on #{host}" do
|
|
13
|
-
profile_path = File.join(
|
|
14
|
-
fixtures_path,
|
|
15
|
-
'inspec_profiles',
|
|
16
|
-
"#{fact_on(host, 'os.name')}-#{fact_on(host, 'os.release.major')}-#{profile}",
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
if File.exist?(profile_path)
|
|
20
|
-
let(:inspec) do
|
|
21
|
-
Simp::BeakerHelpers::Inspec.enable_repo_on(hosts)
|
|
22
|
-
Simp::BeakerHelpers::Inspec.new(host, profile)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
let(:inspec_report_data) { inspec.process_inspec_results }
|
|
26
|
-
|
|
27
|
-
# rubocop:disable RSpec/RepeatedDescription
|
|
28
|
-
it 'runs inspec' do
|
|
29
|
-
inspec.run
|
|
30
|
-
end
|
|
31
|
-
# rubocop:enable RSpec/RepeatedDescription
|
|
32
|
-
|
|
33
|
-
it 'has an inspec report' do
|
|
34
|
-
expect(inspec_report_data).not_to be_nil
|
|
35
|
-
|
|
36
|
-
inspec.write_report(inspec_report_data)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
it 'has a report' do
|
|
40
|
-
expect(inspec_report_data[:report]).not_to be_nil
|
|
41
|
-
puts inspec_report_data[:report] # rubocop:disable RSpec/Output
|
|
42
|
-
end
|
|
43
|
-
else
|
|
44
|
-
# rubocop:disable RSpec/RepeatedDescription
|
|
45
|
-
it 'runs inspec' do
|
|
46
|
-
skip("No matching profile available at #{profile_path}")
|
|
47
|
-
end
|
|
48
|
-
# rubocop:enable RSpec/RepeatedDescription
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
../../nodesets
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
RedHat-7-disa_stig
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
skips = {
|
|
2
|
-
'V-72209' => 'Cannot guarantee a remote syslog server during test'
|
|
3
|
-
}
|
|
4
|
-
overrides = [ 'V-72091' ]
|
|
5
|
-
subsystems = []
|
|
6
|
-
|
|
7
|
-
require_controls 'disa_stig-el7-baseline' do
|
|
8
|
-
skips.each_pair do |ctrl, reason|
|
|
9
|
-
control ctrl do
|
|
10
|
-
describe "Skip #{ctrl}" do
|
|
11
|
-
skip "Reason: #{skips[ctrl]}" do
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
@conf['profile'].info[:controls].each do |ctrl|
|
|
18
|
-
next if (overrides + skips.keys).include?(ctrl[:id])
|
|
19
|
-
|
|
20
|
-
if subsystems.empty?
|
|
21
|
-
control ctrl[:id]
|
|
22
|
-
else
|
|
23
|
-
tags = ctrl[:tags]
|
|
24
|
-
if tags && tags[:subsystems]
|
|
25
|
-
subsystems.each do |subsystem|
|
|
26
|
-
if tags[:subsystems].include?(subsystem)
|
|
27
|
-
control ctrl[:id]
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
## Overrides ##
|
|
35
|
-
|
|
36
|
-
# There's no email server to send anything to by default so syslog is a safer
|
|
37
|
-
# default for processing.
|
|
38
|
-
control 'V-72091' do
|
|
39
|
-
overrides << self.to_s
|
|
40
|
-
|
|
41
|
-
describe auditd_conf do
|
|
42
|
-
its('space_left_action.downcase') { should cmp 'syslog' }
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
name: EL7 STIG
|
|
2
|
-
title: STIG for EL 7
|
|
3
|
-
supports:
|
|
4
|
-
- os-family: redhat
|
|
5
|
-
maintainer: SIMP Team
|
|
6
|
-
copyright: Onyx Point, Inc.
|
|
7
|
-
copyright_email: simp@onyxpoint.com
|
|
8
|
-
license: Apache-2.0
|
|
9
|
-
summary: |
|
|
10
|
-
A collection of InSpec tests
|
|
11
|
-
version: 0.0.1
|
|
12
|
-
depends:
|
|
13
|
-
- name: disa_stig-el7-baseline
|
|
14
|
-
path: ../../inspec_deps/inspec_profiles/profiles/disa_stig-el7-baseline
|