simp-beaker-helpers 1.18.9 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.fips_fixtures +8 -0
- data/.fixtures.yml +1 -0
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +334 -89
- data/.travis.yml +39 -33
- data/CHANGELOG.md +50 -0
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/lib/simp/beaker_helpers.rb +191 -71
- data/lib/simp/beaker_helpers/constants.rb +6 -2
- data/lib/simp/beaker_helpers/version.rb +1 -1
- data/spec/acceptance/nodesets/default.yml +19 -9
- data/spec/acceptance/nodesets/ubuntu.yml +20 -0
- data/spec/acceptance/suites/default/check_puppet_version_spec.rb +2 -2
- data/spec/acceptance/suites/default/fixture_modules_spec.rb +22 -4
- data/spec/acceptance/suites/default/install_simp_deps_repo_spec.rb +14 -20
- data/spec/lib/simp/beaker_helpers_spec.rb +17 -34
- metadata +38 -7
@@ -5,7 +5,7 @@ module Simp::BeakerHelpers
|
|
5
5
|
#
|
6
6
|
# This is done so that we know if some new thing that we're using breaks the
|
7
7
|
# oldest system that we support
|
8
|
-
DEFAULT_PUPPET_AGENT_VERSION = '~>
|
8
|
+
DEFAULT_PUPPET_AGENT_VERSION = '~> 6.0'
|
9
9
|
|
10
10
|
SSG_REPO_URL = ENV['BEAKER_ssg_repo'] || 'https://github.com/ComplianceAsCode/content.git'
|
11
11
|
|
@@ -17,7 +17,11 @@ module Simp::BeakerHelpers
|
|
17
17
|
require 'open-uri'
|
18
18
|
|
19
19
|
begin
|
20
|
-
|
20
|
+
if URI.respond_to?(:open)
|
21
|
+
ONLINE = true if URI.open('http://google.com')
|
22
|
+
else
|
23
|
+
ONLINE = true if open('http://google.com')
|
24
|
+
end
|
21
25
|
rescue
|
22
26
|
ONLINE = false
|
23
27
|
end
|
@@ -6,28 +6,27 @@
|
|
6
6
|
end
|
7
7
|
-%>
|
8
8
|
HOSTS:
|
9
|
-
|
9
|
+
el7:
|
10
10
|
roles:
|
11
|
-
- server
|
12
|
-
- master
|
13
|
-
- default
|
14
11
|
- el7
|
12
|
+
- master
|
15
13
|
platform: el-7-x86_64
|
16
14
|
box: centos/7
|
17
15
|
hypervisor: <%= hypervisor %>
|
18
16
|
|
19
|
-
|
17
|
+
el8:
|
20
18
|
roles:
|
21
|
-
-
|
22
|
-
platform: el-
|
23
|
-
box: centos/
|
19
|
+
- el8
|
20
|
+
platform: el-8-x86_64
|
21
|
+
box: centos/8
|
24
22
|
hypervisor: <%= hypervisor %>
|
25
23
|
|
26
|
-
|
24
|
+
el8-0:
|
27
25
|
roles:
|
28
26
|
- el8
|
29
27
|
platform: el-8-x86_64
|
30
28
|
box: centos/8
|
29
|
+
box_version: "1905.1"
|
31
30
|
hypervisor: <%= hypervisor %>
|
32
31
|
|
33
32
|
CONFIG:
|
@@ -37,3 +36,14 @@ CONFIG:
|
|
37
36
|
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
|
38
37
|
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
|
39
38
|
<% end -%>
|
39
|
+
ssh:
|
40
|
+
keepalive: true
|
41
|
+
keepalive_interval: 10
|
42
|
+
host_key:
|
43
|
+
- <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:host_key].join("\n#{' '*6}- ") %>
|
44
|
+
kex:
|
45
|
+
- <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:kex].join("\n#{' '*6}- ") %>
|
46
|
+
encryption:
|
47
|
+
- <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:encryption].join("\n#{' '*6}- ") %>
|
48
|
+
hmac:
|
49
|
+
- <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:hmac].join("\n#{' '*6}- ") %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%
|
2
|
+
if ENV['BEAKER_HYPERVISOR']
|
3
|
+
hypervisor = ENV['BEAKER_HYPERVISOR']
|
4
|
+
else
|
5
|
+
hypervisor = 'vagrant'
|
6
|
+
end
|
7
|
+
-%>
|
8
|
+
HOSTS:
|
9
|
+
focal:
|
10
|
+
platform: ubuntu-20.04-x86_64
|
11
|
+
box: ubuntu/focal64
|
12
|
+
hypervisor: <%= hypervisor %>
|
13
|
+
|
14
|
+
CONFIG:
|
15
|
+
log_level: verbose
|
16
|
+
type: aio
|
17
|
+
vagrant_memsize: 256
|
18
|
+
<% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
|
19
|
+
puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
|
20
|
+
<% end -%>
|
@@ -14,8 +14,8 @@ hosts.each do |host|
|
|
14
14
|
expect(client_puppet_version.split('.').first).to eq(puppet_collection_version)
|
15
15
|
end
|
16
16
|
else
|
17
|
-
it 'should
|
18
|
-
expect(client_puppet_version.split('.').first).to eq '
|
17
|
+
it 'should be running puppet 6' do
|
18
|
+
expect(client_puppet_version.split('.').first).to eq '6'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -8,15 +8,33 @@ context 'after copy_fixture_modules_to( hosts )' do
|
|
8
8
|
|
9
9
|
describe "fact_on(master,'root_home')" do
|
10
10
|
it 'should not return value of `root_home`' do
|
11
|
-
|
12
|
-
expect( fact ).to eq ''
|
11
|
+
expect(fact_on(master, 'root_home')).to eq ''
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
describe "pfact_on(master,'root_home')" do
|
17
16
|
it 'should return value of `root_home`' do
|
18
|
-
|
19
|
-
|
17
|
+
expect(pfact_on(master, 'root_home')).to eq '/root'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "pfact_on(master,'os.release.major')" do
|
22
|
+
it 'should return the value of `os.release.major`' do
|
23
|
+
expect(pfact_on(master, 'os.release.major')).to match(/.+/)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "pfact_on(master,'os.release.foo')" do
|
28
|
+
it 'should not return the value of `os.release.foo`' do
|
29
|
+
expect(pfact_on(master, 'os.release.foo')).to eq ''
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "pfact_on(master,'fips_enabled')" do
|
34
|
+
expected = (ENV['BEAKER_fips'] == 'yes')
|
35
|
+
|
36
|
+
it 'should return false' do
|
37
|
+
expect(pfact_on(master, 'fips_enabled')).to eq expected
|
20
38
|
end
|
21
39
|
end
|
22
40
|
end
|
@@ -2,42 +2,36 @@ require 'spec_helper_acceptance'
|
|
2
2
|
|
3
3
|
hosts.each do |host|
|
4
4
|
describe '#write_hieradata_to' do
|
5
|
+
expect_failures = false
|
6
|
+
if hosts_with_role(hosts, 'el8').include?(host)
|
7
|
+
expect_failures = true
|
8
|
+
end
|
5
9
|
|
6
10
|
it 'should install yum utils' do
|
7
11
|
host.install_package('yum-utils')
|
8
12
|
end
|
9
13
|
|
10
|
-
context '
|
14
|
+
context 'default settings' do
|
11
15
|
before(:all) { install_simp_repos(host) }
|
12
16
|
|
13
|
-
it 'creates the repo' do
|
14
|
-
on host, 'test -f /etc/yum.repos.d/simp.repo'
|
15
|
-
on host, 'test -f /etc/yum.repos.d/simp_deps.repo'
|
16
|
-
end
|
17
|
-
|
18
17
|
it 'enables the correct repos' do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
expect(simp6depsinfo).to match(/.*Repo-status.*enabled.*/)
|
18
|
+
skip "#{host} is not supported yet" if expect_failures
|
19
|
+
on(host, 'yum -y list simp')
|
20
|
+
on(host, 'yum -y list postgresql96')
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
26
24
|
context 'when passed a disabled list ' do
|
27
|
-
before(:all) { install_simp_repos(host, ['simp'] ) }
|
25
|
+
before(:all) { install_simp_repos(host, ['simp-community-simp'] ) }
|
28
26
|
|
29
|
-
it '
|
30
|
-
|
31
|
-
on
|
27
|
+
it 'enables the correct repos' do
|
28
|
+
skip "#{host} is not supported yet" if expect_failures
|
29
|
+
on(host, 'yum -y list postgresql96')
|
32
30
|
end
|
33
31
|
|
34
|
-
it '
|
35
|
-
|
36
|
-
expect(simp6info).to match(/.*Repo-status.*disabled.*/)
|
37
|
-
simp6depsinfo = on(host, 'yum repolist -v simp_deps| grep ^Repo-status').stdout.strip
|
38
|
-
expect(simp6depsinfo).to match(/.*Repo-status.*enabled.*/)
|
32
|
+
it 'disables the correct repos' do
|
33
|
+
on(host, 'yum -y list simp', :acceptable_exit_codes => [1])
|
39
34
|
end
|
40
35
|
end
|
41
|
-
|
42
36
|
end
|
43
37
|
end
|
@@ -103,19 +103,22 @@ describe 'Simp::BeakerHelpers' do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'uses defaults when no environment variables are set' do
|
106
|
-
expect( @helper.get_puppet_install_info[:puppet_install_version] ).to match(/^5\./)
|
107
|
-
expect( @helper.get_puppet_install_info[:puppet_collection] ).to eq('puppet5')
|
108
|
-
expect( @helper.get_puppet_install_info[:puppet_install_type] ).to eq('agent')
|
109
|
-
end
|
110
106
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
107
|
+
# Prevent namespace pollution
|
108
|
+
pipe_out,pipe_in = IO.pipe
|
109
|
+
fork do
|
110
|
+
pipe_out.close
|
111
|
+
require 'puppet'
|
112
|
+
pipe_in.write(Puppet.version)
|
113
|
+
end
|
114
|
+
pipe_in.close
|
115
|
+
|
116
|
+
expected_version = pipe_out.gets
|
117
|
+
expected_major_version = expected_version.split('.').first
|
118
|
+
|
119
|
+
expect( @helper.get_puppet_install_info[:puppet_install_version] ).to match(expected_version)
|
120
|
+
expect( @helper.get_puppet_install_info[:puppet_collection] ).to eq("puppet#{expected_major_version}")
|
121
|
+
expect( @helper.get_puppet_install_info[:puppet_install_type] ).to eq('agent')
|
119
122
|
end
|
120
123
|
|
121
124
|
it 'extracts info from PUPPET_INSTALL_VERSION for Puppet 5' do
|
@@ -153,26 +156,6 @@ describe 'Simp::BeakerHelpers' do
|
|
153
156
|
expect( @helper.get_puppet_install_info ).to eq expected
|
154
157
|
end
|
155
158
|
|
156
|
-
it 'extracts info from BEAKER_PUPPET_AGENT_VERSION' do
|
157
|
-
ENV['BEAKER_PUPPET_AGENT_VERSION']= '4.10.5'
|
158
|
-
expected = {
|
159
|
-
:puppet_install_version => '1.10.5',
|
160
|
-
:puppet_collection => nil,
|
161
|
-
:puppet_install_type => 'agent'
|
162
|
-
}
|
163
|
-
expect( @helper.get_puppet_install_info ).to eq expected
|
164
|
-
end
|
165
|
-
|
166
|
-
it 'extracts info from PUPPET_VERSION' do
|
167
|
-
ENV['PUPPET_VERSION']= '4.10.5'
|
168
|
-
expected = {
|
169
|
-
:puppet_install_version => '1.10.5',
|
170
|
-
:puppet_collection => nil,
|
171
|
-
:puppet_install_type => 'agent'
|
172
|
-
}
|
173
|
-
expect( @helper.get_puppet_install_info ).to eq expected
|
174
|
-
end
|
175
|
-
|
176
159
|
it 'extracts info from BEAKER_PUPPET_COLLECTION' do
|
177
160
|
allow(@helper).to receive(:`).with('gem search -ra -e puppet').and_return(gem_search_results)
|
178
161
|
ENV['BEAKER_PUPPET_COLLECTION']= 'puppet5'
|
@@ -198,9 +181,9 @@ describe 'Simp::BeakerHelpers' do
|
|
198
181
|
it 'extracts info from PUPPET_INSTALL_TYPE' do
|
199
182
|
ENV['PUPPET_INSTALL_TYPE'] = 'pe'
|
200
183
|
|
201
|
-
expect( @helper.get_puppet_install_info[:puppet_collection] ).to eq('
|
184
|
+
expect( @helper.get_puppet_install_info[:puppet_collection] ).to eq('puppet6')
|
202
185
|
expect( @helper.get_puppet_install_info[:puppet_install_type] ).to eq('pe')
|
203
|
-
expect( @helper.get_puppet_install_info[:puppet_install_version] ).to match(/^
|
186
|
+
expect( @helper.get_puppet_install_info[:puppet_install_version] ).to match(/^6\./)
|
204
187
|
end
|
205
188
|
|
206
189
|
it 'fails when BEAKER_PUPPET_COLLECTION is invalid' do
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-beaker-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Tessmer
|
8
8
|
- Trevor Vaughan
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: beaker
|
@@ -161,6 +161,7 @@ executables: []
|
|
161
161
|
extensions: []
|
162
162
|
extra_rdoc_files: []
|
163
163
|
files:
|
164
|
+
- ".fips_fixtures"
|
164
165
|
- ".fixtures.yml"
|
165
166
|
- ".gitignore"
|
166
167
|
- ".gitlab-ci.yml"
|
@@ -187,6 +188,7 @@ files:
|
|
187
188
|
- lib/simp/rake/beaker.rb
|
188
189
|
- simp-beaker-helpers.gemspec
|
189
190
|
- spec/acceptance/nodesets/default.yml
|
191
|
+
- spec/acceptance/nodesets/ubuntu.yml
|
190
192
|
- spec/acceptance/suites/default/check_puppet_version_spec.rb
|
191
193
|
- spec/acceptance/suites/default/enable_fips_spec.rb
|
192
194
|
- spec/acceptance/suites/default/fixture_modules_spec.rb
|
@@ -219,7 +221,7 @@ licenses:
|
|
219
221
|
- Apache-2.0
|
220
222
|
metadata:
|
221
223
|
issue_tracker: https://simp-project.atlassian.net
|
222
|
-
post_install_message:
|
224
|
+
post_install_message:
|
223
225
|
rdoc_options: []
|
224
226
|
require_paths:
|
225
227
|
- lib
|
@@ -234,8 +236,37 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
236
|
- !ruby/object:Gem::Version
|
235
237
|
version: '0'
|
236
238
|
requirements: []
|
237
|
-
rubygems_version: 3.0.
|
238
|
-
signing_key:
|
239
|
+
rubygems_version: 3.0.9
|
240
|
+
signing_key:
|
239
241
|
specification_version: 4
|
240
242
|
summary: beaker helper methods for SIMP
|
241
|
-
test_files:
|
243
|
+
test_files:
|
244
|
+
- spec/acceptance/nodesets/default.yml
|
245
|
+
- spec/acceptance/nodesets/ubuntu.yml
|
246
|
+
- spec/acceptance/suites/default/check_puppet_version_spec.rb
|
247
|
+
- spec/acceptance/suites/default/enable_fips_spec.rb
|
248
|
+
- spec/acceptance/suites/default/fixture_modules_spec.rb
|
249
|
+
- spec/acceptance/suites/default/install_simp_deps_repo_spec.rb
|
250
|
+
- spec/acceptance/suites/default/nodesets
|
251
|
+
- spec/acceptance/suites/default/pki_tests_spec.rb
|
252
|
+
- spec/acceptance/suites/default/set_hieradata_on_spec.rb
|
253
|
+
- spec/acceptance/suites/default/write_hieradata_to_spec.rb
|
254
|
+
- spec/acceptance/suites/fips_from_fixtures/00_default_spec.rb
|
255
|
+
- spec/acceptance/suites/fips_from_fixtures/metadata.yml
|
256
|
+
- spec/acceptance/suites/fips_from_fixtures/nodesets
|
257
|
+
- spec/acceptance/suites/offline/00_default_spec.rb
|
258
|
+
- spec/acceptance/suites/offline/README
|
259
|
+
- spec/acceptance/suites/offline/nodesets/default.yml
|
260
|
+
- spec/acceptance/suites/puppet_collections/00_default_spec.rb
|
261
|
+
- spec/acceptance/suites/puppet_collections/metadata.yml
|
262
|
+
- spec/acceptance/suites/snapshot/00_snapshot_test_spec.rb
|
263
|
+
- spec/acceptance/suites/snapshot/10_general_usage_spec.rb
|
264
|
+
- spec/acceptance/suites/snapshot/nodesets
|
265
|
+
- spec/acceptance/suites/windows/00_default_spec.rb
|
266
|
+
- spec/acceptance/suites/windows/metadata.yml
|
267
|
+
- spec/acceptance/suites/windows/nodesets/default.yml
|
268
|
+
- spec/acceptance/suites/windows/nodesets/win2016.yml
|
269
|
+
- spec/acceptance/suites/windows/nodesets/win2019.yml
|
270
|
+
- spec/lib/simp/beaker_helpers_spec.rb
|
271
|
+
- spec/spec_helper.rb
|
272
|
+
- spec/spec_helper_acceptance.rb
|