simp-beaker-helpers 1.18.8 → 1.19.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 not be running puppet 5' do
18
- expect(client_puppet_version.split('.').first).to eq '5'
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
- puts fact = fact_on(master, 'root_home')
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
- puts fact = pfact_on(master, 'root_home')
19
- expect( fact ).to eq '/root'
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 'defailt settings' do
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
- simp6info = on(host, '/usr/bin/yum repolist -v simp | grep ^Repo-status').stdout.strip
20
- expect(simp6info).to match(/.*Repo-status.*enabled.*/)
21
- simp6depsinfo = on(host, 'yum repolist -v simp_deps| grep ^Repo-status').stdout.strip
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 'creates the repo' do
30
- on host, 'test -f /etc/yum.repos.d/simp.repo'
31
- on host, 'test -f /etc/yum.repos.d/simp_deps.repo'
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 'enables the correct repos' do
35
- simp6info = on(host, 'yum repolist -v simp | grep ^Repo-status').stdout.strip
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
@@ -1 +1 @@
1
- spec/acceptance/suites/default/../../nodesets
1
+ ../../nodesets
@@ -31,7 +31,10 @@ ScrubFixtures.new
31
31
  ENV['BEAKER_fips'] = 'yes'
32
32
  ENV['FIXTURES_YML'] = alt_fixtures
33
33
 
34
+ beaker_gem_options = ENV['BEAKER_GEM_OPTIONS']
35
+
34
36
  Bundler.with_clean_env{
37
+ ENV['BEAKER_GEM_OPTIONS'] = beaker_gem_options
35
38
  ENV['FIXTURES_YML'] = alt_fixtures
36
39
 
37
40
  %x{bundle exec rake spec_prep}
@@ -1 +1 @@
1
- spec/acceptance/suites/fips_from_fixtures/../../nodesets
1
+ ../../nodesets
@@ -1,24 +1,22 @@
1
- # This needs to be done so that we actually bring in a collection at the start
2
- # of the run
3
- #
4
- # Choosing an arbitrary number in the middle of 5 so that we're not fooled by
5
- # edge cases
6
- #
7
- ENV['PUPPET_VERSION'] = '5.1'
8
-
9
1
  require 'spec_helper_acceptance'
10
2
 
11
- Bundler.with_clean_env{
12
- %x{bundle exec rake spec_prep}
13
- }
3
+ unless ENV['PUPPET_VERSION'] || ENV['BEAKER_PUPPET_COLLECTION']
4
+ fail('You must set either PUPPET_VERSION or BEAKER_PUPPET_COLLECTION as an environment variable')
5
+ end
6
+
7
+ if ENV['BEAKER_PUPPET_COLLECTION']
8
+ target_version = ENV['BEAKER_PUPPET_COLLECTION'][/(\d+)$/,1]
9
+ elsif ENV['PUPPET_VERSION']
10
+ target_version = ENV['PUPPET_VERSION'].split('.').first
11
+ end
14
12
 
15
13
  hosts.each do |host|
16
14
  describe 'make sure puppet version is valid' do
17
15
  context "on #{host}" do
18
16
  client_puppet_version = on(host, 'puppet --version').output.strip
19
17
 
20
- it "should be running puppet version #{ENV['PUPPET_VERSION']}}" do
21
- expect(Gem::Version.new(client_puppet_version)).to be >= Gem::Version.new(ENV['PUPPET_VERSION'])
18
+ it "should be running puppet version #{target_version}" do
19
+ expect(Gem::Version.new(client_puppet_version)).to be >= Gem::Version.new(target_version)
22
20
  end
23
21
  end
24
22
  end
@@ -1 +1 @@
1
- spec/acceptance/suites/snapshot/../../nodesets
1
+ ../../nodesets
@@ -10,12 +10,14 @@ HOSTS:
10
10
  roles:
11
11
  - windows
12
12
  platform: windows-server-amd64
13
- box: opentable/win-2012r2-standard-amd64-nocm # VBOX ONLY
13
+ box: devopsgroup-io/windows_server-2012r2-standard-amd64-nocm
14
14
  hypervisor: <%= hypervisor %>
15
15
  vagrant_memsize: 2048
16
16
  vagrant_cpus: 2
17
17
  user: vagrant
18
18
  is_cygwin: false
19
+ ssh:
20
+ host_key: ssh-dss
19
21
 
20
22
  el7:
21
23
  roles:
@@ -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
- it 'extracts info from PUPPET_INSTALL_VERSION for Puppet 4' do
112
- ENV['PUPPET_INSTALL_VERSION']= '4.10.5'
113
- expected = {
114
- :puppet_install_version => '1.10.5',
115
- :puppet_collection => nil,
116
- :puppet_install_type => 'agent'
117
- }
118
- expect( @helper.get_puppet_install_info ).to eq expected
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('puppet5')
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(/^5\./)
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.18.8
4
+ version: 1.19.4
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: 2020-07-21 00:00:00.000000000 Z
12
+ date: 2021-01-05 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"
@@ -203,7 +204,6 @@ files:
203
204
  - spec/acceptance/suites/offline/nodesets/default.yml
204
205
  - spec/acceptance/suites/puppet_collections/00_default_spec.rb
205
206
  - spec/acceptance/suites/puppet_collections/metadata.yml
206
- - spec/acceptance/suites/puppet_collections/nodesets/default.yml
207
207
  - spec/acceptance/suites/snapshot/00_snapshot_test_spec.rb
208
208
  - spec/acceptance/suites/snapshot/10_general_usage_spec.rb
209
209
  - spec/acceptance/suites/snapshot/nodesets
@@ -220,7 +220,7 @@ licenses:
220
220
  - Apache-2.0
221
221
  metadata:
222
222
  issue_tracker: https://simp-project.atlassian.net
223
- post_install_message:
223
+ post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -235,9 +235,36 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  requirements: []
238
- rubyforge_project:
239
- rubygems_version: 2.7.7
240
- signing_key:
238
+ rubygems_version: 3.0.9
239
+ signing_key:
241
240
  specification_version: 4
242
241
  summary: beaker helper methods for SIMP
243
- test_files: []
242
+ test_files:
243
+ - spec/acceptance/nodesets/default.yml
244
+ - spec/acceptance/suites/default/check_puppet_version_spec.rb
245
+ - spec/acceptance/suites/default/enable_fips_spec.rb
246
+ - spec/acceptance/suites/default/fixture_modules_spec.rb
247
+ - spec/acceptance/suites/default/install_simp_deps_repo_spec.rb
248
+ - spec/acceptance/suites/default/nodesets
249
+ - spec/acceptance/suites/default/pki_tests_spec.rb
250
+ - spec/acceptance/suites/default/set_hieradata_on_spec.rb
251
+ - spec/acceptance/suites/default/write_hieradata_to_spec.rb
252
+ - spec/acceptance/suites/fips_from_fixtures/00_default_spec.rb
253
+ - spec/acceptance/suites/fips_from_fixtures/metadata.yml
254
+ - spec/acceptance/suites/fips_from_fixtures/nodesets
255
+ - spec/acceptance/suites/offline/00_default_spec.rb
256
+ - spec/acceptance/suites/offline/README
257
+ - spec/acceptance/suites/offline/nodesets/default.yml
258
+ - spec/acceptance/suites/puppet_collections/00_default_spec.rb
259
+ - spec/acceptance/suites/puppet_collections/metadata.yml
260
+ - spec/acceptance/suites/snapshot/00_snapshot_test_spec.rb
261
+ - spec/acceptance/suites/snapshot/10_general_usage_spec.rb
262
+ - spec/acceptance/suites/snapshot/nodesets
263
+ - spec/acceptance/suites/windows/00_default_spec.rb
264
+ - spec/acceptance/suites/windows/metadata.yml
265
+ - spec/acceptance/suites/windows/nodesets/default.yml
266
+ - spec/acceptance/suites/windows/nodesets/win2016.yml
267
+ - spec/acceptance/suites/windows/nodesets/win2019.yml
268
+ - spec/lib/simp/beaker_helpers_spec.rb
269
+ - spec/spec_helper.rb
270
+ - spec/spec_helper_acceptance.rb
@@ -1,30 +0,0 @@
1
- <%
2
- if ENV['BEAKER_HYPERVISOR']
3
- hypervisor = ENV['BEAKER_HYPERVISOR']
4
- else
5
- hypervisor = 'vagrant'
6
- end
7
- -%>
8
- HOSTS:
9
- server-el7:
10
- roles:
11
- - server
12
- - default
13
- - master
14
- - el7
15
- platform: el-7-x86_64
16
- box: centos/7
17
- hypervisor: <%= hypervisor %>
18
-
19
- server-el6:
20
- roles:
21
- - el6
22
- platform: el-6-x86_64
23
- box: centos/6
24
- hypervisor: <%= hypervisor %>
25
-
26
- CONFIG:
27
- log_level: verbose
28
- type: aio
29
- puppet_collection: puppet5
30
- vagrant_memsize: 256