simp-beaker-helpers 1.0.7 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.fixtures.yml +5 -0
- data/.rspec +3 -0
- data/Gemfile +12 -0
- data/Rakefile +17 -5
- data/files/pki/make.sh +9 -10
- data/lib/simp/beaker_helpers.rb +39 -10
- data/lib/simp/rake/beaker.rb +50 -0
- data/simp-beaker-helpers.gemspec +1 -1
- data/spec/acceptance/nodesets/centos-66-x64.yml +22 -0
- data/spec/acceptance/nodesets/centos-7-x64.yml +22 -0
- data/spec/acceptance/nodesets/centos-combined-x64.yaml +24 -0
- data/spec/acceptance/nodesets/default.yml +23 -0
- data/spec/acceptance/pki_tests_spec.rb +70 -0
- data/spec/spec_helper_acceptance.rb +40 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmEwZWNlYzg3YjU4NzRjMTcwZmI0ODQ2OTEzZGEwNzZmNDJkM2RiYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjA0MTM5ZjM3M2FkYWZhNTJjNmY0OGQ1NmJlODEyOThjODMzZWExNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjhmZmYzY2JjNWE5ZTY5ZTJmYTc5ZDA2Zjk5ODA0NGFjZmIxNzQyY2MyMTIz
|
10
|
+
YjMzOTUyY2RhY2Y3ODMzNWFlNjhkNzMwODIxOGM5MjZkZDlkMjhlMjAwYWFj
|
11
|
+
ZGIzYmI5NzJhM2Y5OWYxZGVkZDhiYjJhNTdiMWYyMDllOGYzNjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmEwZGU5NjAwZWU4YTBkZTk4ZmI1YWU3MjczMDdmYjE3YjRkYjRlZTczZWI0
|
14
|
+
Mzc3ODE1OWMzNjMyNDkxMWZlNTg1YzFmZGYwNjFmNGMwOTgxYWY3ZTEwMGNi
|
15
|
+
MTUyMzY3YWVmZmVhOTkzMTRmYzczZWZiMDFhZTA4MDgxYTBhYjM=
|
data/.fixtures.yml
ADDED
data/.rspec
ADDED
data/Gemfile
CHANGED
@@ -11,3 +11,15 @@ gemspec
|
|
11
11
|
# mandatory gems
|
12
12
|
gem 'bundler'
|
13
13
|
gem 'rake'
|
14
|
+
gem 'puppetlabs_spec_helper'
|
15
|
+
gem 'puppet'
|
16
|
+
|
17
|
+
|
18
|
+
group :system_tests do
|
19
|
+
gem 'pry'
|
20
|
+
gem 'beaker'
|
21
|
+
gem 'beaker-rspec'
|
22
|
+
# NOTE: Workaround because net-ssh 2.10 is busting beaker
|
23
|
+
# lib/ruby/1.9.1/socket.rb:251:in `tcp': wrong number of arguments (5 for 4) (ArgumentError)
|
24
|
+
gem 'net-ssh', '~> 2.9.0'
|
25
|
+
end
|
data/Rakefile
CHANGED
@@ -4,6 +4,13 @@ require 'rubygems'
|
|
4
4
|
require 'rake/clean'
|
5
5
|
require 'fileutils'
|
6
6
|
require 'find'
|
7
|
+
require 'rspec/core/rake_task'
|
8
|
+
require 'puppetlabs_spec_helper/rake_tasks'
|
9
|
+
|
10
|
+
|
11
|
+
['spec','syntax','syntax:hiera','syntax:manifests','syntax:templates','lint','metadata'].each do |task|
|
12
|
+
Rake::Task[task].clear
|
13
|
+
end
|
7
14
|
|
8
15
|
@package='simp-beaker-helpers'
|
9
16
|
@rakefile_dir=File.dirname(__FILE__)
|
@@ -39,15 +46,20 @@ SIMP_RPM_BUILD when set, alters the gem produced by pkg:gem to be RPM-safe.
|
|
39
46
|
}
|
40
47
|
end
|
41
48
|
|
42
|
-
desc 'run all RSpec tests'
|
43
|
-
task :spec do
|
44
|
-
Dir.chdir @rakefile_dir
|
45
|
-
sh 'bundle exec rspec spec'
|
46
|
-
end
|
49
|
+
#desc 'run all RSpec tests'
|
50
|
+
#task :spec do
|
51
|
+
# Dir.chdir @rakefile_dir
|
52
|
+
# sh 'bundle exec rspec spec'
|
53
|
+
#end
|
47
54
|
|
48
55
|
desc %q{run all RSpec tests (alias of 'spec')}
|
49
56
|
task :test => :spec
|
50
57
|
|
58
|
+
desc "Run acceptance tests"
|
59
|
+
RSpec::Core::RakeTask.new(:acceptance) do |t|
|
60
|
+
t.pattern = 'spec/acceptance'
|
61
|
+
end
|
62
|
+
|
51
63
|
namespace :pkg do
|
52
64
|
@specfile_template = "rubygem-#{@package}.spec.template"
|
53
65
|
@specfile = "build/rubygem-#{@package}.spec"
|
data/files/pki/make.sh
CHANGED
@@ -9,7 +9,6 @@ CAKEY=./cakey.pem
|
|
9
9
|
CACERT=./cacert.pem
|
10
10
|
CASERIAL=`uuidgen | cut -f1 -d'-'`
|
11
11
|
|
12
|
-
|
13
12
|
keydist=keydist
|
14
13
|
|
15
14
|
# start clean
|
@@ -17,16 +16,16 @@ bash clean.sh
|
|
17
16
|
|
18
17
|
mkdir -p working "${keydist}" "${keydist}/cacerts"
|
19
18
|
|
20
|
-
# Create new CA
|
19
|
+
# Create new CA if necessary
|
21
20
|
# ------------------------------------------------------------------------------
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
mkdir -p ${CATOP} ${CATOP}/certs ${CATOP}/crl ${CATOP}/newcerts ${CATOP}/private
|
22
|
+
if [ ! -f cacertkey ]; then
|
23
|
+
dd if=/dev/urandom status=none bs=60 count=1 | openssl base64 -e -nopad | tr -d '\n' > cacertkey
|
24
|
+
echo '' >> cacertkey
|
25
|
+
fi
|
26
|
+
if [ ! -f ${CATOP}/serial ]; then
|
27
|
+
echo "01" > ${CATOP}/serial
|
28
|
+
fi
|
30
29
|
touch ${CATOP}/index.txt
|
31
30
|
|
32
31
|
echo "== Making CA certificate ..."
|
data/lib/simp/beaker_helpers.rb
CHANGED
@@ -1,30 +1,36 @@
|
|
1
1
|
module Simp; end
|
2
2
|
|
3
3
|
module Simp::BeakerHelpers
|
4
|
-
VERSION = '1.0.
|
4
|
+
VERSION = '1.0.9'
|
5
5
|
|
6
6
|
# Locates .fixture.yml in or above this directory.
|
7
7
|
def fixtures_yml_path
|
8
|
+
STDERR.puts ' ** fixtures_yml_path' if ENV['BEAKER_helpers_verbose']
|
8
9
|
fixtures_yml = ''
|
9
10
|
dir = '.'
|
10
11
|
while( fixtures_yml.empty? && File.expand_path(dir) != '/' ) do
|
11
12
|
file = File.expand_path( '.fixtures.yml', dir )
|
13
|
+
STDERR.puts " ** fixtures_yml_path: #{file}" if ENV['BEAKER_helpers_verbose']
|
12
14
|
if File.exists? file
|
13
15
|
fixtures_yml = file
|
14
16
|
break
|
15
17
|
end
|
18
|
+
dir = "#{dir}/.."
|
16
19
|
end
|
17
20
|
raise 'ERROR: cannot locate .fixtures.yml!' if fixtures_yml.empty?
|
21
|
+
STDERR.puts " ** fixtures_yml_path:finished (file: '#{file}')" if ENV['BEAKER_helpers_verbose']
|
18
22
|
fixtures_yml
|
19
23
|
end
|
20
24
|
|
21
25
|
|
22
26
|
# returns an Array of puppet modules declared in .fixtures.yml
|
23
27
|
def pupmods_in_fixtures_yml
|
28
|
+
STDERR.puts ' ** pupmods_in_fixtures_yml' if ENV['BEAKER_helpers_verbose']
|
24
29
|
fixtures_yml = fixtures_yml_path
|
25
30
|
data = YAML.load_file( fixtures_yml )
|
26
31
|
repos = data.fetch('fixtures').fetch('repositories', {}).keys || []
|
27
32
|
symlinks = data.fetch('fixtures').fetch('symlinks', {}).keys || []
|
33
|
+
STDERR.puts ' ** pupmods_in_fixtures_yml: finished' if ENV['BEAKER_helpers_verbose']
|
28
34
|
(repos + symlinks)
|
29
35
|
end
|
30
36
|
|
@@ -33,11 +39,13 @@ module Simp::BeakerHelpers
|
|
33
39
|
# if any fixture modules are missing, run 'rake spec_prep' to populate the
|
34
40
|
# fixtures/modules
|
35
41
|
def ensure_fixture_modules
|
42
|
+
STDERR.puts " ** ensure_fixture_modules" if ENV['BEAKER_helpers_verbose']
|
36
43
|
unless ENV['BEAKER_spec_prep'] == 'no'
|
37
44
|
puts "== checking prepped modules from .fixtures.yml"
|
38
45
|
puts " -- (use BEAKER_spec_prep=no to disable)"
|
39
46
|
missing_modules = []
|
40
47
|
pupmods_in_fixtures_yml.each do |pupmod|
|
48
|
+
STDERR.puts " ** -- ensure_fixture_modules: '#{pupmod}'" if ENV['BEAKER_helpers_verbose']
|
41
49
|
mod_root = File.expand_path( "spec/fixtures/modules/#{pupmod}", File.dirname( fixtures_yml_path ))
|
42
50
|
missing_modules << pupmod unless File.directory? mod_root
|
43
51
|
end
|
@@ -50,20 +58,30 @@ module Simp::BeakerHelpers
|
|
50
58
|
puts " == all fixture modules present"
|
51
59
|
end
|
52
60
|
end
|
61
|
+
STDERR.puts " ** -- ensure_fixture_modules: finished" if ENV['BEAKER_helpers_verbose']
|
53
62
|
end
|
54
63
|
|
64
|
+
|
55
65
|
# Copy the local fixture modules (under `spec/fixtures/modules`) onto each SUT
|
56
|
-
def copy_fixture_modules_to( suts = hosts )
|
66
|
+
def copy_fixture_modules_to( suts = hosts, pluginsync = true )
|
67
|
+
STDERR.puts ' ** copy_fixture_modules_to' if ENV['BEAKER_helpers_verbose']
|
57
68
|
ensure_fixture_modules
|
69
|
+
|
58
70
|
suts.each do |sut|
|
71
|
+
STDERR.puts " ** copy_fixture_modules_to: '#{sut}'" if ENV['BEAKER_helpers_verbose']
|
59
72
|
# allow spec_prep to provide modules (to support isolated networks)
|
60
73
|
unless ENV['BEAKER_use_fixtures_dir_for_modules'] == 'no'
|
61
74
|
pupmods_in_fixtures_yml.each do |pupmod|
|
75
|
+
STDERR.puts " ** copy_fixture_modules_to: '#{sut}': '#{pupmod}'" if ENV['BEAKER_helpers_verbose']
|
62
76
|
mod_root = File.expand_path( "spec/fixtures/modules/#{pupmod}", File.dirname( fixtures_yml_path ))
|
63
77
|
copy_module_to( sut, {:source => mod_root, :module_name => pupmod} )
|
64
78
|
end
|
65
79
|
end
|
80
|
+
STDERR.puts ' ** copy_fixture_modules_to: finished' if ENV['BEAKER_helpers_verbose']
|
66
81
|
end
|
82
|
+
|
83
|
+
# sync custom facts from the new modules to each SUT's factpath
|
84
|
+
pluginsync_on(suts) if pluginsync
|
67
85
|
end
|
68
86
|
|
69
87
|
|
@@ -114,6 +132,7 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
|
|
114
132
|
end
|
115
133
|
end
|
116
134
|
|
135
|
+
|
117
136
|
# Apply known OS fixes we need to run Beaker on each SUT
|
118
137
|
def fix_errata_on( suts = hosts )
|
119
138
|
# SIMP uses structured facts, therefore stringify_facts must be disabled
|
@@ -165,7 +184,11 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
|
|
165
184
|
on ca_sut, "cd #{host_dir}; cat #{host_dir}/pki.hosts | xargs bash make.sh"
|
166
185
|
end
|
167
186
|
|
168
|
-
|
187
|
+
# if a local_dir was provided, copy everything down to it
|
188
|
+
unless local_dir.empty?
|
189
|
+
FileUtils.mkdir_p local_dir
|
190
|
+
scp_from( ca_sut, host_dir, local_dir )
|
191
|
+
end
|
169
192
|
end
|
170
193
|
|
171
194
|
|
@@ -198,15 +221,18 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
|
|
198
221
|
# Copy a CA keydist/ directory of CA+host certs into an SUT
|
199
222
|
#
|
200
223
|
# This simulates the output of FakeCA's gencerts_nopass.sh to keydist/
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
on ca_sut, "
|
207
|
-
on ca_sut, "
|
224
|
+
def copy_keydist_to( ca_sut = master, host_keydist_dir = nil )
|
225
|
+
if !host_keydist_dir
|
226
|
+
modulepath = on(ca_sut, 'puppet config print modulepath --environment production' ).output.chomp.split(':')
|
227
|
+
host_keydist_dir = "#{modulepath.first}/pki/files/keydist"
|
228
|
+
end
|
229
|
+
on ca_sut, "rm -rf #{host_keydist_dir}/*"
|
230
|
+
on ca_sut, "mkdir -p #{host_keydist_dir}/"
|
231
|
+
on ca_sut, "cp -pR /root/pki/keydist/. #{host_keydist_dir}/"
|
232
|
+
on ca_sut, "chgrp -R puppet #{host_keydist_dir}"
|
208
233
|
end
|
209
234
|
|
235
|
+
|
210
236
|
## Inline Hiera Helpers ##
|
211
237
|
## These will be integrated into core Beaker at some point ##
|
212
238
|
|
@@ -225,6 +251,7 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
|
|
225
251
|
end
|
226
252
|
end
|
227
253
|
|
254
|
+
|
228
255
|
# Set the hiera data file on the provided host to the passed data structure
|
229
256
|
#
|
230
257
|
# Note: This is authoritative, you cannot mix this with other hieradata copies
|
@@ -267,6 +294,7 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
|
|
267
294
|
write_hiera_config_on(host, Array(data_file))
|
268
295
|
end
|
269
296
|
|
297
|
+
|
270
298
|
# Clean up all temporary hiera data files.
|
271
299
|
#
|
272
300
|
# Meant to be called from after(:all)
|
@@ -280,6 +308,7 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
|
|
280
308
|
end
|
281
309
|
end
|
282
310
|
|
311
|
+
|
283
312
|
# pluginsync custom facts for all modules
|
284
313
|
def pluginsync_on( suts = hosts )
|
285
314
|
suts.each do |sut|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/tasklib'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'puppetlabs_spec_helper/rake_tasks'
|
6
|
+
|
7
|
+
module Simp; end
|
8
|
+
module Simp::Rake
|
9
|
+
class Beaker < ::Rake::TaskLib
|
10
|
+
def initialize(base_dir)
|
11
|
+
|
12
|
+
@base_dir = base_dir
|
13
|
+
@clean_list = []
|
14
|
+
|
15
|
+
::CLEAN.include( %{#{@base_dir}/log} )
|
16
|
+
::CLEAN.include( %{#{@base_dir}/junit} )
|
17
|
+
|
18
|
+
yield self if block_given?
|
19
|
+
|
20
|
+
::CLEAN.include( @clean_list )
|
21
|
+
|
22
|
+
namespace :beaker do
|
23
|
+
desc <<-EOM
|
24
|
+
Run a Beaker test against a specific Nodeset
|
25
|
+
* :nodeset - The nodeset against which you wish to run
|
26
|
+
EOM
|
27
|
+
task :run, [:nodeset] do |t,args|
|
28
|
+
fail "You must pass :nodeset to #{t}" unless args[:nodeset]
|
29
|
+
nodeset = args[:nodeset].strip
|
30
|
+
|
31
|
+
old_stdout = $stdout
|
32
|
+
nodesets = StringIO.new
|
33
|
+
$stdout = nodesets
|
34
|
+
|
35
|
+
Rake::Task['beaker_nodes'].invoke
|
36
|
+
|
37
|
+
$stdout = old_stdout
|
38
|
+
|
39
|
+
nodesets = nodesets.string.split("\n")
|
40
|
+
|
41
|
+
fail "Nodeset '#{nodeset}' not found. Valid Nodesets:\n#{nodesets.map{|x| x = %( * #{x})}.join(%(\n))}" unless nodesets.include?(nodeset)
|
42
|
+
|
43
|
+
ENV['BEAKER_set'] = nodeset
|
44
|
+
|
45
|
+
Rake::Task['beaker'].invoke
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/simp-beaker-helpers.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
EOF
|
12
12
|
s.version = Simp::BeakerHelpers::VERSION
|
13
13
|
s.license = 'Apache-2.0'
|
14
|
-
s.authors = ['Chris Tessmer']
|
14
|
+
s.authors = ['Chris Tessmer','Trevor Vaughan']
|
15
15
|
s.email = 'simp@simp-project.org'
|
16
16
|
s.homepage = 'https://github.com/simp/rubygem-simp-beaker-helpers'
|
17
17
|
s.metadata = {
|
@@ -0,0 +1,22 @@
|
|
1
|
+
HOSTS:
|
2
|
+
server:
|
3
|
+
roles:
|
4
|
+
- default
|
5
|
+
- master
|
6
|
+
- server
|
7
|
+
platform: el-6-x86_64
|
8
|
+
box: puppetlabs/centos-6.6-64-nocm
|
9
|
+
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm
|
10
|
+
hypervisor: vagrant
|
11
|
+
client:
|
12
|
+
roles:
|
13
|
+
- agent
|
14
|
+
- client
|
15
|
+
platform: el-6-x86_64
|
16
|
+
box: puppetlabs/centos-6.6-64-nocm
|
17
|
+
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm
|
18
|
+
hypervisor: vagrant
|
19
|
+
CONFIG:
|
20
|
+
log_level: verbose
|
21
|
+
type: foss
|
22
|
+
vagrant_memsize: 256
|
@@ -0,0 +1,22 @@
|
|
1
|
+
HOSTS:
|
2
|
+
server:
|
3
|
+
roles:
|
4
|
+
- server
|
5
|
+
- default
|
6
|
+
- master
|
7
|
+
platform: el-7-x86_64
|
8
|
+
box: puppetlabs/centos-7.0-64-nocm
|
9
|
+
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
|
10
|
+
hypervisor: vagrant
|
11
|
+
client:
|
12
|
+
roles:
|
13
|
+
- client
|
14
|
+
- agent
|
15
|
+
platform: el-7-x86_64
|
16
|
+
box: puppetlabs/centos-7.0-64-nocm
|
17
|
+
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
|
18
|
+
hypervisor: vagrant
|
19
|
+
CONFIG:
|
20
|
+
log_level: verbose
|
21
|
+
type: foss
|
22
|
+
vagrant_memsize: 256
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This nodeset spins up a simple one-host test VM for both EL6 and EL7
|
2
|
+
HOSTS:
|
3
|
+
centos-7:
|
4
|
+
roles:
|
5
|
+
- server
|
6
|
+
- default
|
7
|
+
- master
|
8
|
+
platform: el-7-x86_64
|
9
|
+
box: puppetlabs/centos-7.0-64-nocm
|
10
|
+
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
|
11
|
+
hypervisor: vagrant
|
12
|
+
centos-6:
|
13
|
+
roles:
|
14
|
+
- agent
|
15
|
+
- client
|
16
|
+
platform: el-6-x86_64
|
17
|
+
box: puppetlabs/centos-6.6-64-nocm
|
18
|
+
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm
|
19
|
+
hypervisor: vagrant
|
20
|
+
CONFIG:
|
21
|
+
log_level: verbose
|
22
|
+
type: foss
|
23
|
+
vagrant_memsize: 256
|
24
|
+
## vb_gui: true
|
@@ -0,0 +1,23 @@
|
|
1
|
+
HOSTS:
|
2
|
+
server:
|
3
|
+
roles:
|
4
|
+
- server
|
5
|
+
- default
|
6
|
+
- master
|
7
|
+
platform: el-7-x86_64
|
8
|
+
box: puppetlabs/centos-7.0-64-nocm
|
9
|
+
box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
|
10
|
+
hypervisor: vagrant
|
11
|
+
## client:
|
12
|
+
## roles:
|
13
|
+
## - client
|
14
|
+
## - agent
|
15
|
+
## platform: el-7-x86_64
|
16
|
+
## box: puppetlabs/centos-7.0-64-nocm
|
17
|
+
## box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm
|
18
|
+
## hypervisor: vagrant
|
19
|
+
CONFIG:
|
20
|
+
log_level: verbose
|
21
|
+
type: foss
|
22
|
+
vagrant_memsize: 256
|
23
|
+
## vb_gui: true
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper_acceptance'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
|
5
|
+
context 'PKI operations' do
|
6
|
+
#test_name 'SIMP beaker helper PKI operations'
|
7
|
+
begin
|
8
|
+
|
9
|
+
context 'after run_fake_pki_ca_on(master,hosts)' do
|
10
|
+
before(:all) do
|
11
|
+
copy_fixture_modules_to( hosts )
|
12
|
+
end
|
13
|
+
|
14
|
+
shared_examples_for 'a correctly copied keydist/ tree' do |test_dir|
|
15
|
+
it 'correctly copies keydist/ tree' do
|
16
|
+
on(master, "ls -d #{test_dir}" +
|
17
|
+
" #{test_dir}/cacerts" +
|
18
|
+
" #{test_dir}/cacerts/cacert_*.pem"
|
19
|
+
)
|
20
|
+
|
21
|
+
hosts.each do |host|
|
22
|
+
name = host.node_name
|
23
|
+
on(master, "ls -d #{test_dir}/#{name}/cacerts" +
|
24
|
+
" #{test_dir}/#{name}/#{name}.pem" +
|
25
|
+
" #{test_dir}/#{name}/#{name}.pub" +
|
26
|
+
" #{test_dir}/cacerts/cacert_*.pem"
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'a Fake CA under /root' do
|
33
|
+
@tmp_keydist_dir = Dir.mktmpdir 'simp-beaker-helpers__pki-tests'
|
34
|
+
run_fake_pki_ca_on( master, hosts, @tmp_keydist_dir )
|
35
|
+
|
36
|
+
it 'should create /root/pki' do
|
37
|
+
on(master, 'test -d /root/pki')
|
38
|
+
end
|
39
|
+
|
40
|
+
it_behaves_like 'a correctly copied keydist/ tree', '/root/pki/keydist'
|
41
|
+
|
42
|
+
### TODO: fix scoping issues
|
43
|
+
### it "copied keydist back to local directory '#{@tmp_keydist_dir}'" do
|
44
|
+
### require 'pry'; binding.pry
|
45
|
+
### expect( File.directory? @tmp_keydist_dir ).to be_truthy
|
46
|
+
### end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
describe 'after copy_keydist_to' do
|
51
|
+
test_dir = '/etc/puppet/modules/pki/files/keydist'
|
52
|
+
copy_keydist_to(master)
|
53
|
+
it_behaves_like 'a correctly copied keydist/ tree', test_dir
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'after copy_keydist_to(master,"/tmp/foo")' do
|
57
|
+
test_dir = '/tmp/foo'
|
58
|
+
copy_keydist_to(master, test_dir)
|
59
|
+
it_behaves_like 'a correctly copied keydist/ tree', test_dir
|
60
|
+
end
|
61
|
+
|
62
|
+
after( :all ) do
|
63
|
+
FileUtils.remove_entry_secure( @tmp_keydist_dir )
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
rescue Exception => e
|
68
|
+
require 'pry'; binding.pry
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'beaker-rspec'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'yaml'
|
4
|
+
require 'simp/beaker_helpers'
|
5
|
+
include Simp::BeakerHelpers
|
6
|
+
|
7
|
+
unless ENV['BEAKER_provision'] == 'no'
|
8
|
+
hosts.each do |host|
|
9
|
+
# Install Puppet
|
10
|
+
if host.is_pe?
|
11
|
+
install_pe
|
12
|
+
else
|
13
|
+
install_puppet
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
RSpec.configure do |c|
|
20
|
+
# ensure that environment OS is ready on each host
|
21
|
+
fix_errata_on(hosts)
|
22
|
+
|
23
|
+
# Readable test descriptions
|
24
|
+
c.formatter = :documentation
|
25
|
+
|
26
|
+
# Configure all nodes in nodeset
|
27
|
+
c.before :suite do
|
28
|
+
begin
|
29
|
+
# Install modules and dependencies from spec/fixtures/modules
|
30
|
+
copy_fixture_modules_to( hosts )
|
31
|
+
STDOUT.flush
|
32
|
+
rescue StandardError, ScriptError => e
|
33
|
+
if ENV['PRY']
|
34
|
+
require 'pry'; binding.pry
|
35
|
+
else
|
36
|
+
raise e
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simp-beaker-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Tessmer
|
8
|
+
- Trevor Vaughan
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
12
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: beaker
|
@@ -32,7 +33,9 @@ executables: []
|
|
32
33
|
extensions: []
|
33
34
|
extra_rdoc_files: []
|
34
35
|
files:
|
36
|
+
- .fixtures.yml
|
35
37
|
- .gitignore
|
38
|
+
- .rspec
|
36
39
|
- .travis.yml
|
37
40
|
- Gemfile
|
38
41
|
- LICENSE
|
@@ -43,7 +46,14 @@ files:
|
|
43
46
|
- files/pki/template_ca.cnf
|
44
47
|
- files/pki/template_host.cnf
|
45
48
|
- lib/simp/beaker_helpers.rb
|
49
|
+
- lib/simp/rake/beaker.rb
|
46
50
|
- simp-beaker-helpers.gemspec
|
51
|
+
- spec/acceptance/nodesets/centos-66-x64.yml
|
52
|
+
- spec/acceptance/nodesets/centos-7-x64.yml
|
53
|
+
- spec/acceptance/nodesets/centos-combined-x64.yaml
|
54
|
+
- spec/acceptance/nodesets/default.yml
|
55
|
+
- spec/acceptance/pki_tests_spec.rb
|
56
|
+
- spec/spec_helper_acceptance.rb
|
47
57
|
homepage: https://github.com/simp/rubygem-simp-beaker-helpers
|
48
58
|
licenses:
|
49
59
|
- Apache-2.0
|
@@ -69,4 +79,10 @@ rubygems_version: 2.4.8
|
|
69
79
|
signing_key:
|
70
80
|
specification_version: 4
|
71
81
|
summary: beaker helper methods for SIMP
|
72
|
-
test_files:
|
82
|
+
test_files:
|
83
|
+
- spec/acceptance/nodesets/centos-66-x64.yml
|
84
|
+
- spec/acceptance/nodesets/centos-7-x64.yml
|
85
|
+
- spec/acceptance/nodesets/centos-combined-x64.yaml
|
86
|
+
- spec/acceptance/nodesets/default.yml
|
87
|
+
- spec/acceptance/pki_tests_spec.rb
|
88
|
+
- spec/spec_helper_acceptance.rb
|