beaker 3.18.0 → 3.19.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.
Files changed (45) hide show
  1. checksums.yaml +8 -8
  2. data/Rakefile +0 -23
  3. data/beaker.gemspec +1 -0
  4. data/lib/beaker/dsl/helpers.rb +3 -4
  5. data/lib/beaker/dsl/install_utils.rb +2 -7
  6. data/lib/beaker/dsl/wrappers.rb +0 -87
  7. data/lib/beaker/host/unix/pkg.rb +56 -17
  8. data/lib/beaker/hypervisor/docker.rb +26 -1
  9. data/lib/beaker/options/parser.rb +12 -5
  10. data/lib/beaker/options/subcommand_options_file_parser.rb +11 -4
  11. data/lib/beaker/ssh_connection.rb +6 -6
  12. data/lib/beaker/subcommand.rb +6 -0
  13. data/lib/beaker/version.rb +1 -1
  14. data/spec/beaker/host/unix/pkg_spec.rb +130 -0
  15. data/spec/beaker/hypervisor/docker_spec.rb +28 -1
  16. data/spec/beaker/options/parser_spec.rb +38 -18
  17. data/spec/beaker/options/subcommand_options_parser_spec.rb +28 -5
  18. data/spec/beaker/ssh_connection_spec.rb +17 -17
  19. metadata +16 -28
  20. data/acceptance/config/puppetgem/acceptance-options.rb +0 -9
  21. data/acceptance/config/puppetgit/acceptance-options.rb +0 -9
  22. data/acceptance/config/puppetpkg/acceptance-options.rb +0 -8
  23. data/acceptance/pre_suite/puppet_gem/install.rb +0 -8
  24. data/acceptance/pre_suite/puppet_git/install.rb +0 -98
  25. data/acceptance/pre_suite/puppet_pkg/install.rb +0 -9
  26. data/acceptance/tests/puppet/README.md +0 -3
  27. data/acceptance/tests/puppet/install_smoke_test.rb +0 -21
  28. data/acceptance/tests/puppet/stub_host.rb +0 -47
  29. data/acceptance/tests/puppet/web_helpers_test.rb +0 -55
  30. data/acceptance/tests/puppet/with_puppet_running_on.rb +0 -26
  31. data/lib/beaker/dsl/helpers/puppet_helpers.rb +0 -865
  32. data/lib/beaker/dsl/helpers/tk_helpers.rb +0 -89
  33. data/lib/beaker/dsl/install_utils/aio_defaults.rb +0 -93
  34. data/lib/beaker/dsl/install_utils/ezbake_utils.rb +0 -256
  35. data/lib/beaker/dsl/install_utils/foss_defaults.rb +0 -211
  36. data/lib/beaker/dsl/install_utils/foss_utils.rb +0 -1307
  37. data/lib/beaker/dsl/install_utils/module_utils.rb +0 -244
  38. data/lib/beaker/dsl/install_utils/puppet_utils.rb +0 -157
  39. data/lib/beaker/options/homedir_options_file_parser.rb +0 -0
  40. data/spec/beaker/dsl/helpers/facter_helpers_spec.rb +0 -59
  41. data/spec/beaker/dsl/helpers/puppet_helpers_spec.rb +0 -1179
  42. data/spec/beaker/dsl/helpers/tk_helpers_spec.rb +0 -83
  43. data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +0 -1307
  44. data/spec/beaker/dsl/install_utils/module_utils_spec.rb +0 -261
  45. data/spec/beaker/dsl/install_utils/puppet_utils_spec.rb +0 -136
@@ -1,261 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class ClassMixedWithDSLInstallUtils
4
- include Beaker::DSL::InstallUtils
5
- include Beaker::DSL::Wrappers
6
- include Beaker::DSL::Helpers
7
- include Beaker::DSL::Structure
8
- include Beaker::DSL::Roles
9
- include Beaker::DSL::Patterns
10
-
11
- def logger
12
- @logger ||= RSpec::Mocks::Double.new('logger').as_null_object
13
- end
14
- end
15
-
16
- describe ClassMixedWithDSLInstallUtils do
17
- let(:presets) { Beaker::Options::Presets.new }
18
- let(:opts) { presets.presets.merge(presets.env_vars) }
19
- let(:basic_hosts) { make_hosts( { :pe_ver => '3.0',
20
- :platform => 'linux',
21
- :roles => [ 'agent' ] }, 4 ) }
22
- let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard']
23
- basic_hosts[1][:platform] = 'windows'
24
- basic_hosts[2][:platform] = 'osx-10.9-x86_64'
25
- basic_hosts[3][:platform] = 'eos'
26
- basic_hosts }
27
- let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] }
28
-
29
-
30
-
31
- describe '#install_dev_puppet_module_on' do
32
- context 'having set allow( a ).to receive forge' do
33
- it 'stubs the forge on the host' do
34
- master = hosts.first
35
- allow( subject ).to receive( :options ).and_return( {:forge_host => 'ahost.com'} )
36
-
37
- expect( subject ).to receive( :with_forge_stubbed_on )
38
-
39
- subject.install_dev_puppet_module_on( master, {:source => '/module', :module_name => 'test'} )
40
- end
41
-
42
- it 'installs via #install_puppet_module_via_pmt' do
43
- master = hosts.first
44
- allow( subject ).to receive( :options ).and_return( {:forge_host => 'ahost.com'} )
45
- allow( subject ).to receive( :with_forge_stubbed_on ).and_yield
46
-
47
- expect( subject ).to receive( :install_puppet_module_via_pmt_on )
48
-
49
- subject.install_dev_puppet_module_on( master, {:source => '/module', :module_name => 'test'} )
50
- end
51
- end
52
- context 'without allow( a ).to receive forge (default)' do
53
- it 'calls copy_module_to to get the module on the SUT' do
54
- master = hosts.first
55
- allow( subject ).to receive( :options ).and_return( {} )
56
-
57
- expect( subject ).to receive( :copy_module_to )
58
-
59
- subject.install_dev_puppet_module_on( master, {:source => '/module', :module_name => 'test'} )
60
- end
61
- end
62
- end
63
-
64
- describe '#install_dev_puppet_module' do
65
- it 'delegates to #install_dev_puppet_module_on with the hosts list' do
66
- allow( subject ).to receive( :hosts ).and_return( hosts )
67
- allow( subject ).to receive( :options ).and_return( {} )
68
-
69
- hosts.each do |host|
70
- expect( subject ).to receive( :install_dev_puppet_module_on ).
71
- with( host, {:source => '/module', :module_name => 'test'})
72
- end
73
-
74
- subject.install_dev_puppet_module( {:source => '/module', :module_name => 'test'} )
75
- end
76
- end
77
-
78
- describe '#install_puppet_module_via_pmt_on' do
79
- it 'installs module via puppet module tool' do
80
- allow( subject ).to receive( :hosts ).and_return( hosts )
81
- master = hosts.first
82
-
83
- allow( subject ).to receive( :on ).once
84
- expect( subject ).to receive( :puppet ).with('module install test ', {}).once
85
-
86
- subject.install_puppet_module_via_pmt_on( master, {:module_name => 'test'} )
87
- end
88
-
89
- it 'takes the trace option and passes it down correctly' do
90
- allow( subject ).to receive( :hosts ).and_return( hosts )
91
- master = hosts.first
92
- trace_opts = { :trace => nil }
93
- master['default_module_install_opts'] = trace_opts
94
-
95
- allow( subject ).to receive( :on ).once
96
- expect( subject ).to receive( :puppet ).with('module install test ', trace_opts).once
97
-
98
- subject.install_puppet_module_via_pmt_on( master, {:module_name => 'test'} )
99
- end
100
- end
101
-
102
- describe '#install_puppet_module_via_pmt' do
103
- it 'delegates to #install_puppet_module_via_pmt with the hosts list' do
104
- allow( subject ).to receive( :hosts ).and_return( hosts )
105
-
106
- expect( subject ).to receive( :install_puppet_module_via_pmt_on ).with( hosts, {:source => '/module', :module_name => 'test'}).once
107
-
108
- subject.install_puppet_module_via_pmt( {:source => '/module', :module_name => 'test'} )
109
- end
110
- end
111
-
112
- describe 'copy_module_to' do
113
- let(:ignore_list) { Beaker::DSL::InstallUtils::ModuleUtils::PUPPET_MODULE_INSTALL_IGNORE }
114
- let(:source){ File.expand_path('./')}
115
- let(:target){'/etc/puppetlabs/puppet/modules/testmodule'}
116
- let(:module_parse_name){'testmodule'}
117
-
118
- shared_examples 'copy_module_to' do |opts|
119
- it{
120
- host = double("host")
121
- allow( host ).to receive(:[]).with('distmoduledir').and_return('/etc/puppetlabs/puppet/modules')
122
- allow( host ).to receive(:is_powershell?).and_return(false)
123
- result = double
124
- stdout = target.split('/')[0..-2].join('/') + "\n"
125
- allow( result ).to receive(:stdout).and_return( stdout )
126
- expect( subject ).to receive(:on).with(host, "echo #{File.dirname(target)}" ).and_return(result )
127
- allow( Dir ).to receive(:getpwd).and_return(source)
128
-
129
- allow( subject ).to receive(:parse_for_moduleroot).and_return(source)
130
- if module_parse_name
131
- allow( subject ).to receive(:parse_for_modulename).with(any_args()).and_return(module_parse_name)
132
- else
133
- expect( subject).to_not receive(:parse_for_modulename)
134
- end
135
-
136
- allow( File ).to receive(:exists?).with(any_args()).and_return(false)
137
- allow( File ).to receive(:directory?).with(any_args()).and_return(false)
138
-
139
- expect( subject ).to receive(:scp_to).with(host,source, File.dirname(target), {:ignore => ignore_list})
140
- expect( host ).to receive(:mv).with(File.join(File.dirname(target), File.basename(source)), target)
141
- if opts.nil?
142
- subject.copy_module_to(host)
143
- else
144
- subject.copy_module_to(host,opts)
145
- end
146
- }
147
- end
148
-
149
- describe 'should call scp with the correct info, with only providing host' do
150
- let(:target){'/etc/puppetlabs/puppet/modules/testmodule'}
151
-
152
- it_should_behave_like 'copy_module_to', :module_name => 'testmodule'
153
- end
154
-
155
- describe 'should call scp with the correct info, when specifying the modulename' do
156
- let(:target){'/etc/puppetlabs/puppet/modules/bogusmodule'}
157
- let(:module_parse_name){false}
158
- it_should_behave_like 'copy_module_to', {:module_name =>'bogusmodule'}
159
- end
160
-
161
- describe 'should call scp with the correct info, when specifying the target to a different path' do
162
- target = '/opt/shared/puppet/modules'
163
- let(:target){"#{target}/testmodule"}
164
- it_should_behave_like 'copy_module_to', {:target_module_path => target, :module_name => 'testmodule'}
165
- end
166
-
167
- describe 'should accept multiple hosts when' do
168
- it 'used in a default manner' do
169
- allow( subject ).to receive( :build_ignore_list ).and_return( [] )
170
- allow( subject ).to receive( :parse_for_modulename ).and_return( [nil, 'modulename'] )
171
- allow( subject ).to receive( :on ).and_return( double.as_null_object )
172
-
173
- expect( subject ).to receive( :scp_to ).exactly(4).times
174
- subject.copy_module_to( hosts )
175
- end
176
- end
177
-
178
- describe 'non-cygwin windows' do
179
- it 'should have different commands than cygwin' do
180
- host = double("host")
181
- allow( host ).to receive(:[]).with('platform').and_return('windows')
182
- allow( host ).to receive(:[]).with('distmoduledir').and_return('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules')
183
- allow( host ).to receive(:is_powershell?).and_return(true)
184
-
185
- result = double
186
- allow( result ).to receive(:stdout).and_return( 'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules' )
187
-
188
- expect( subject ).to receive(:on).with(host, "echo C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules" ).and_return( result )
189
-
190
- expect( subject ).to receive(:scp_to).with(host, "/opt/testmodule2", "C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules", {:ignore => ignore_list})
191
- expect( host ).to receive(:mv).with('C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules\\testmodule2', 'C:\\ProgramData\\PuppetLabs\\puppet\\etc\\modules\\testmodule')
192
-
193
- subject.copy_module_to(host, {:module_name => 'testmodule', :source => '/opt/testmodule2'})
194
- end
195
- end
196
- end
197
-
198
- describe 'split_author_modulename' do
199
- it 'should return a correct modulename' do
200
- result = subject.split_author_modulename('myname-test_43_module')
201
- expect(result[:author]).to eq('myname')
202
- expect(result[:module]).to eq('test_43_module')
203
- end
204
- end
205
-
206
- describe 'get_module_name' do
207
- it 'should return an array of author and modulename' do
208
- expect(subject.get_module_name('myname-test_43_module')).to eq(['myname', 'test_43_module'])
209
- end
210
- it 'should return nil for invalid names' do
211
- expect(subject.get_module_name('myname-')).to eq(nil)
212
- end
213
- end
214
-
215
- describe 'parse_for_modulename' do
216
- directory = '/testfilepath/myname-testmodule'
217
- it 'should return name from metadata.json' do
218
- allow( File ).to receive(:exists?).with("#{directory}/metadata.json").and_return(true)
219
- allow( File ).to receive(:read).with("#{directory}/metadata.json").and_return(" {\"name\":\"myname-testmodule\"} ")
220
- expect( subject.logger ).to receive(:debug).with("Attempting to parse Modulename from metadata.json")
221
- expect(subject.logger).to_not receive(:debug).with('Unable to determine name, returning null')
222
- expect(subject.parse_for_modulename(directory)).to eq(['myname', 'testmodule'])
223
- end
224
- it 'should return name from Modulefile' do
225
- allow( File ).to receive(:exists?).with("#{directory}/metadata.json").and_return(false)
226
- allow( File ).to receive(:exists?).with("#{directory}/Modulefile").and_return(true)
227
- allow( File ).to receive(:read).with("#{directory}/Modulefile").and_return("name 'myname-testmodule' \nauthor 'myname'")
228
- expect( subject.logger ).to receive(:debug).with("Attempting to parse Modulename from Modulefile")
229
- expect(subject.logger).to_not receive(:debug).with("Unable to determine name, returning null")
230
- expect(subject.parse_for_modulename(directory)).to eq(['myname', 'testmodule'])
231
- end
232
- end
233
-
234
- describe 'parse_for_module_root' do
235
- directory = '/testfilepath/myname-testmodule'
236
- describe 'stops searching when either' do
237
- it 'finds a Modulefile' do
238
- allow( File ).to receive(:exists?).and_return(false)
239
- allow( File ).to receive(:exists?).with("#{directory}/Modulefile").and_return(true)
240
-
241
- expect( subject.logger ).to_not receive(:debug).with("At root, can't parse for another directory")
242
- expect( subject.logger ).to receive(:debug).with("No Modulefile or metadata.json found at #{directory}/acceptance, moving up")
243
- expect(subject.parse_for_moduleroot("#{directory}/acceptance")).to eq(directory)
244
- end
245
- it 'finds a metadata.json file' do
246
- allow( File ).to receive(:exists?).and_return(false)
247
- allow( File ).to receive(:exists?).with("#{directory}/metadata.json").and_return(true)
248
-
249
- expect( subject.logger ).to_not receive(:debug).with("At root, can't parse for another directory")
250
- expect( subject.logger ).to receive(:debug).with("No Modulefile or metadata.json found at #{directory}/acceptance, moving up")
251
- expect(subject.parse_for_moduleroot("#{directory}/acceptance")).to eq(directory)
252
- end
253
- end
254
- it 'should recersively go up the directory to find the module files' do
255
- allow( File ).to receive(:exists?).and_return(false)
256
- expect( subject.logger ).to receive(:debug).with("No Modulefile or metadata.json found at #{directory}, moving up")
257
- expect( subject.logger ).to receive(:error).with("At root, can't parse for another directory")
258
- expect(subject.parse_for_moduleroot(directory)).to eq(nil)
259
- end
260
- end
261
- end
@@ -1,136 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class ClassMixedWithDSLInstallUtils
4
- include Beaker::DSL::Wrappers
5
- include Beaker::DSL::Helpers
6
- include Beaker::DSL::Structure
7
- include Beaker::DSL::Roles
8
- include Beaker::DSL::Patterns
9
- include Beaker::DSL::InstallUtils
10
-
11
- def logger
12
- @logger ||= RSpec::Mocks::Double.new('logger').as_null_object
13
- end
14
- end
15
-
16
- describe ClassMixedWithDSLInstallUtils do
17
- let(:metadata) { @metadata ||= {} }
18
- let(:presets) { Beaker::Options::Presets.new }
19
- let(:opts) { presets.presets.merge(presets.env_vars) }
20
- let(:basic_hosts) { make_hosts( { :pe_ver => '3.0',
21
- :platform => 'linux',
22
- :roles => [ 'agent' ] }, 4 ) }
23
- let(:hosts) { basic_hosts[0][:roles] = ['master', 'database', 'dashboard']
24
- basic_hosts[1][:platform] = 'windows'
25
- basic_hosts[2][:platform] = 'osx-10.9-x86_64'
26
- basic_hosts[3][:platform] = 'eos'
27
- basic_hosts }
28
- let(:hosts_sorted) { [ hosts[1], hosts[0], hosts[2], hosts[3] ] }
29
- let(:winhost) { make_host( 'winhost', { :platform => 'windows',
30
- :pe_ver => '3.0',
31
- :working_dir => '/tmp',
32
- :is_cygwin => true} ) }
33
- let(:winhost_non_cygwin) { make_host( 'winhost_non_cygwin', { :platform => 'windows',
34
- :pe_ver => '3.0',
35
- :working_dir => '/tmp',
36
- :is_cygwin => 'false' } ) }
37
- let(:machost) { make_host( 'machost', { :platform => 'osx-10.9-x86_64',
38
- :pe_ver => '3.0',
39
- :working_dir => '/tmp' } ) }
40
- let(:unixhost) { make_host( 'unixhost', { :platform => 'linux',
41
- :pe_ver => '3.0',
42
- :working_dir => '/tmp',
43
- :dist => 'puppet-enterprise-3.1.0-rc0-230-g36c9e5c-debian-7-i386' } ) }
44
- let(:eoshost) { make_host( 'eoshost', { :platform => 'eos',
45
- :pe_ver => '3.0',
46
- :working_dir => '/tmp',
47
- :dist => 'puppet-enterprise-3.7.1-rc0-78-gffc958f-eos-4-i386' } ) }
48
-
49
- describe "#configure_defaults_on" do
50
-
51
- it "can set foss defaults" do
52
- expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
53
- subject.configure_defaults_on(hosts, 'foss')
54
- end
55
-
56
- it "can set aio defaults" do
57
- expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
58
- subject.configure_defaults_on(hosts, 'aio')
59
- end
60
-
61
- it "can set pe defaults" do
62
- expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
63
- subject.configure_defaults_on(hosts, 'pe')
64
- end
65
-
66
- it 'can remove old defaults ands replace with new' do
67
- expect(subject).to receive(:remove_pe_defaults_on).exactly(hosts.length).times
68
- expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
69
- subject.configure_defaults_on(hosts, 'pe')
70
- subject.configure_defaults_on(hosts, 'foss')
71
- end
72
- end
73
-
74
- describe "#configure_type_defaults_on" do
75
-
76
- it "can set foss defaults for foss type" do
77
- hosts.each do |host|
78
- host['type'] = 'foss'
79
- end
80
- expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
81
- subject.configure_type_defaults_on(hosts)
82
- end
83
-
84
- it "adds aio defaults to foss hosts when they have an aio foss puppet version" do
85
- hosts.each do |host|
86
- host[:pe_ver] = nil
87
- host[:version] = nil
88
- host['type'] = 'foss'
89
- host['version'] = '4.0'
90
- end
91
- expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
92
- expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
93
- subject.configure_type_defaults_on(hosts)
94
- end
95
-
96
- it "adds aio defaults to foss hosts when they have type foss-aio" do
97
- hosts.each do |host|
98
- host[:pe_ver] = nil
99
- host[:version] = nil
100
- host['type'] = 'foss-aio'
101
- end
102
- expect(subject).to receive(:add_foss_defaults_on).exactly(hosts.length).times
103
- expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
104
- subject.configure_type_defaults_on(hosts)
105
- end
106
-
107
- it "can set aio defaults for aio type (backwards compatability)" do
108
- hosts.each do |host|
109
- host[:pe_ver] = nil
110
- host[:version] = nil
111
- host['type'] = 'aio'
112
- end
113
- expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
114
- subject.configure_type_defaults_on(hosts)
115
- end
116
-
117
- it "can set pe defaults for pe type" do
118
- hosts.each do |host|
119
- host['type'] = 'pe'
120
- end
121
- expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
122
- subject.configure_type_defaults_on(hosts)
123
- end
124
-
125
- it "adds aio defaults to pe hosts when they an aio pe version" do
126
- hosts.each do |host|
127
- host['type'] = 'pe'
128
- host['pe_ver'] = '4.0'
129
- end
130
- expect(subject).to receive(:add_pe_defaults_on).exactly(hosts.length).times
131
- expect(subject).to receive(:add_aio_defaults_on).exactly(hosts.length).times
132
- subject.configure_type_defaults_on(hosts)
133
- end
134
-
135
- end
136
- end