beaker 2.44.0 → 2.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +8 -8
  2. data/CONTRIBUTING.md +7 -2
  3. data/HISTORY.md +200 -2
  4. data/acceptance/tests/puppet/web_helpers_test.rb +55 -0
  5. data/docs/Beaker-Libraries.md +2 -0
  6. data/docs/How-To-Beaker.md +0 -1
  7. data/docs/README.md +1 -1
  8. data/docs/how_to/change_terminal_output_coloring.md +32 -0
  9. data/docs/hypervisors/README.md +1 -1
  10. data/docs/hypervisors/openstack.md +80 -4
  11. data/docs/hypervisors/vagrant.md +40 -2
  12. data/docs/runner/test_run.md +31 -0
  13. data/lib/beaker/cli.rb +3 -3
  14. data/lib/beaker/dsl/helpers/web_helpers.rb +13 -4
  15. data/lib/beaker/dsl/install_utils/foss_utils.rb +1 -1
  16. data/lib/beaker/dsl/install_utils/windows_utils.rb +3 -3
  17. data/lib/beaker/host.rb +21 -1
  18. data/lib/beaker/host/unix/pkg.rb +1 -1
  19. data/lib/beaker/hypervisor/openstack.rb +1 -1
  20. data/lib/beaker/hypervisor/vagrant.rb +15 -1
  21. data/lib/beaker/options/hosts_file_parser.rb +54 -14
  22. data/lib/beaker/options/parser.rb +37 -3
  23. data/lib/beaker/options/presets.rb +2 -2
  24. data/lib/beaker/version.rb +1 -1
  25. data/spec/beaker/cli_spec.rb +4 -1
  26. data/spec/beaker/dsl/install_utils/foss_utils_spec.rb +37 -60
  27. data/spec/beaker/dsl/install_utils/windows_utils_spec.rb +3 -3
  28. data/spec/beaker/host/unix/pkg_spec.rb +20 -0
  29. data/spec/beaker/host_prebuilt_steps_spec.rb +7 -7
  30. data/spec/beaker/host_spec.rb +44 -0
  31. data/spec/beaker/hypervisor/openstack_spec.rb +66 -0
  32. data/spec/beaker/hypervisor/vagrant_spec.rb +99 -0
  33. data/spec/beaker/options/hosts_file_parser_spec.rb +95 -22
  34. data/spec/beaker/options/parser_spec.rb +93 -1
  35. data/spec/helpers.rb +10 -2
  36. metadata +6 -3
  37. data/docs/Overview.md +0 -31
@@ -15,7 +15,7 @@ see [downloads.vagrantup.com](http://downloads.vagrantup.com/) for downloads.
15
15
  Currently, we provide a suite of pre-built, publicly available vagrant boxes for
16
16
  use in constructing tests: [Puppet Labs Vagrant Boxes](https://vagrantcloud.com/puppetlabs/).
17
17
  You can use these boxes easily by pulling one of our
18
- [Example Vagrant Hosts Files](Example-Vagrant-Hosts-Files.md).
18
+ [Example Vagrant Hosts Files](vagrant_hosts_file_examples.md).
19
19
 
20
20
  ### Setup a Vagrant Hosts File
21
21
 
@@ -118,4 +118,42 @@ as synced_folders inside the vagrant box. This is done by using the
118
118
  consoleport: 443
119
119
 
120
120
  In the above beaker will mount the folders `./` to `/vagrant/folder1` and the
121
- folder `/tmp` to `/vagrant/tmp`.
121
+ folder `/tmp` to `/vagrant/tmp`.
122
+
123
+ ### Forwarding Ports to Guest
124
+
125
+ When using the Vagrant Hypervisor, beaker can create the Vagrantfile to forward specified ports to a specific box. This is done by using the `forwarded_ports` option in the nodeset file.
126
+
127
+ **Example hosts file**
128
+
129
+ HOSTS:
130
+ ubuntu-1404-x64-master:
131
+ roles:
132
+ - master
133
+ - agent
134
+ - dashboard
135
+ - database
136
+ platform: ubuntu-1404-x86_64
137
+ hypervisor: vagrant
138
+ box: puppetlabs/ubuntu-14.04-64-nocm
139
+ box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm
140
+ ip: 192.168.20.20
141
+ ubuntu-1404-x64-agent:
142
+ roles:
143
+ - agent
144
+ platform: ubuntu-1404-x86_64
145
+ hypervisor: vagrant
146
+ box: puppetlabs/ubuntu-14.04-64-nocm
147
+ box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm
148
+ ip: 192.168.21.21
149
+ forwarded_ports:
150
+ apache:
151
+ from: 10080
152
+ to: 80
153
+ tomcat:
154
+ from: 8080
155
+ to: 8080
156
+ from_ip: '127.0.0.1'
157
+ to_ip: '0.0.0.0'
158
+
159
+ In the above, beaker will forward port 10080 and 8080 on the Host to port 80 and 8080 (respectively) on the Agent guest.
@@ -0,0 +1,31 @@
1
+ # Beaker Test Runs


2
+
3
+ A Beaker run typically has the following phases. All the phases are not mandatory. Each phase provides an option to skip.


4
+
5
+ * Provisioning
6
+ * skip with `--no-provision`
7
+ * Using supported hypervisors provision SUTs for testing on
8
+ * Do any initial configuration to ensure that the SUTs can communicate with beaker and each other
9
+
10
+
11
+ * Validation
12
+ * skip with `--no-validate`
13
+ * Check the SUTs for necessary packages (curl, ntpdate)
14
+
15
+
16
+ * Configuration
17
+ * skip with `--no-configure`
18
+ * Do any post-provisioning configuration to the test nodes
19
+
20
+
21
+ * Testing
22
+ * For test running options, please refer to [Test Suites & Failure Modes](test_suites.md)
23
+
24
+
25
+ * Reverting
26
+ * Skip with `--preserve-hosts`
27
+ * Destroy and cleanup all SUTs
28
+
29
+
30
+ * Cleanup
31
+ * Report test results
@@ -189,14 +189,14 @@ module Beaker
189
189
  @options[:tests] = []
190
190
  @options[:pre_cleanup] = []
191
191
  preserved_hosts_filename = File.join(@options[:log_dated_dir], 'hosts_preserved.yml')
192
- FileUtils.cp(@options[:hosts_file], preserved_hosts_filename)
193
- hosts_yaml = YAML.load_file(preserved_hosts_filename)
192
+
193
+ hosts_yaml = @options
194
194
  newly_keyed_hosts_entries = {}
195
195
  hosts_yaml['HOSTS'].each do |host_name, file_host_hash|
196
196
  h = Beaker::Options::OptionsHash.new
197
197
  file_host_hash = h.merge(file_host_hash)
198
198
  @hosts.each do |host|
199
- if host_name == host.name
199
+ if host_name.to_s == host.name.to_s
200
200
  newly_keyed_hosts_entries[host.reachable_name] = file_host_hash.merge(host.host_hash)
201
201
  break
202
202
  end
@@ -24,6 +24,7 @@ module Beaker
24
24
  url = URI.parse(link)
25
25
  http = Net::HTTP.new(url.host, url.port)
26
26
  http.use_ssl = (url.scheme == 'https')
27
+ http.verify_mode = (OpenSSL::SSL::VERIFY_NONE)
27
28
  http.start do |http|
28
29
  return http.head(url.request_uri).code == "200"
29
30
  end
@@ -52,9 +53,17 @@ module Beaker
52
53
  else
53
54
  logger.notify "Fetching: #{src}"
54
55
  logger.notify " and saving to #{dst}"
55
- open(src, :allow_redirections => :all) do |remote|
56
- File.open(dst, "w") do |file|
57
- FileUtils.copy_stream(remote, file)
56
+ begin
57
+ open(src, :allow_redirections => :all) do |remote|
58
+ File.open(dst, "w") do |file|
59
+ FileUtils.copy_stream(remote, file)
60
+ end
61
+ end
62
+ rescue OpenURI::HTTPError => e
63
+ if e.message =~ /404.*/
64
+ raise "Failed to fetch_remote_file '#{src}' (#{e.message})"
65
+ else
66
+ raise e
58
67
  end
59
68
  end
60
69
  end
@@ -95,7 +104,7 @@ module Beaker
95
104
  logger.debug(line)
96
105
  end
97
106
  if $?.to_i != 0
98
- raise "Failed to fetch_remote_dir '#{url}' (exit code #{$?}"
107
+ raise "Failed to fetch_remote_dir '#{url}' (exit code #{$?})"
99
108
  end
100
109
  dst
101
110
  end
@@ -1210,7 +1210,7 @@ module Beaker
1210
1210
  case host[:platform]
1211
1211
  when /cumulus|huaweios/
1212
1212
  pkgs = on(host, "dpkg-query -l | awk '{print $2}' | grep -E '(^pe-|puppet)'", :acceptable_exit_codes => [0,1]).stdout.chomp.split(/\n+/)
1213
- when /aix/
1213
+ when /aix|sles|el|redhat|centos|oracle|scientific/
1214
1214
  pkgs = on(host, "rpm -qa | grep -E '(^pe-|puppet)'", :acceptable_exit_codes => [0,1]).stdout.chomp.split(/\n+/)
1215
1215
  when /solaris-10/
1216
1216
  cmdline_args = '-a noask'
@@ -144,10 +144,10 @@ exit /B %errorlevel%
144
144
  # emit the misc/versions.txt file which contains component versions for
145
145
  # puppet, facter, hiera, pxp-agent, packaging and vendored Ruby
146
146
  [
147
- "\"%ProgramFiles%\\Puppet Labs\\puppet\\misc\\versions.txt\"",
148
- "\"%ProgramFiles(x86)%\\Puppet Labs\\puppet\\misc\\versions.txt\""
147
+ "\\\"%ProgramFiles%\\Puppet Labs\\puppet\\misc\\versions.txt\\\"",
148
+ "\\\"%ProgramFiles(x86)%\\Puppet Labs\\puppet\\misc\\versions.txt\\\""
149
149
  ].each do |path|
150
- on host, Command.new("if exist #{path} type #{path}", [], { :cmdexe => true })
150
+ on host, Command.new("\"if exist #{path} type #{path}\"", [], { :cmdexe => true })
151
151
  end
152
152
  end
153
153
  end
@@ -224,10 +224,30 @@ module Beaker
224
224
  @logger.warn("Uh oh, this should be handled by sub-classes but hasn't been")
225
225
  end
226
226
 
227
+ # Determine the ip address using logic specific to the hypervisor
228
+ def get_public_ip
229
+ case host_hash[:hypervisor]
230
+ when 'ec2'
231
+ if host_hash[:instance]
232
+ host_hash[:instance].ip_address
233
+ else
234
+ # In the case of using ec2 instances with the --no-provision flag, the ec2
235
+ # instance object does not exist and we should just use the curl endpoint
236
+ # specified here:
237
+ # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html
238
+ if self.instance_of?(Windows::Host)
239
+ execute("wget http://169.254.169.254/latest/meta-data/public-ipv4").strip
240
+ else
241
+ execute("curl http://169.254.169.254/latest/meta-data/public-ipv4").strip
242
+ end
243
+ end
244
+ end
245
+ end
246
+
227
247
  #Return the ip address of this host
228
248
  #Always pull fresh, because this can sometimes change
229
249
  def ip
230
- self['ip'] = get_ip
250
+ self['ip'] = get_public_ip || get_ip
231
251
  end
232
252
 
233
253
  #@return [Boolean] true if x86_64, false otherwise
@@ -148,7 +148,7 @@ module Unix::Pkg
148
148
  execute("zypper --non-interactive rm #{name}", opts)
149
149
  when /el-4/
150
150
  @logger.debug("Package uninstallation not supported on rhel4")
151
- when /fedora-22/
151
+ when /edora-(2[2-9])/
152
152
  execute("dnf -y #{cmdline_args} remove #{name}", opts)
153
153
  when /cisco|fedora|centos|eos|el-/
154
154
  execute("yum -y #{cmdline_args} remove #{name}", opts)
@@ -170,7 +170,7 @@ module Beaker
170
170
  :image_ref => image(host[:image]).id,
171
171
  :nics => [ {'net_id' => network(@options[:openstack_network]).id } ],
172
172
  :name => host[:vmhostname],
173
- :user_data => "#cloud-config\nmanage_etc_hosts: true\n",
173
+ :user_data => host[:user_data] || "#cloud-config\nmanage_etc_hosts: true\n",
174
174
  }
175
175
  options[:key_name] = key_name(host)
176
176
  vm = @compute_client.servers.create(options)
@@ -41,6 +41,20 @@ module Beaker
41
41
  end
42
42
  end
43
43
 
44
+ unless host['forwarded_ports'].nil?
45
+ host['forwarded_ports'].each do |_name, port|
46
+ fwd = " v.vm.network :forwarded_port,"
47
+ fwd << " protocol: '#{port[:protocol]}'," unless port[:protocol].nil?
48
+ fwd << " guest_ip: '#{port[:to_ip]}'," unless port[:to_ip].nil?
49
+ fwd << " guest: #{port[:to]},"
50
+ fwd << " host_ip: '#{port[:from_ip]}'," unless port[:from_ip].nil?
51
+ fwd << " host: #{port[:from]}"
52
+ fwd << "\n"
53
+
54
+ v_file << fwd
55
+ end
56
+ end
57
+
44
58
  if /windows/i.match(host['platform'])
45
59
  #due to a regression bug in versions of vagrant 1.6.2, 1.6.3, 1.6.4, >= 1.7.3 ssh fails to forward
46
60
  #automatically (note <=1.6.1, 1.6.5, 1.7.0 - 1.7.2 are uneffected)
@@ -180,7 +194,7 @@ module Beaker
180
194
  end
181
195
 
182
196
  def cleanup
183
- @logger.debug "removing temporory ssh-config files per-vagrant box"
197
+ @logger.debug "removing temporary ssh-config files per-vagrant box"
184
198
  @temp_files.each do |f|
185
199
  f.close()
186
200
  end
@@ -11,24 +11,47 @@ module Beaker
11
11
  # hosts_hash == {:HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], ... }
12
12
  #
13
13
  # @return [OptionsHash] The contents of the hosts file as an OptionsHash
14
- # @raise [ArgumentError] Raises if hosts_file_path is not a path to a file, or is not a valid YAML file
14
+ # @raise [ArgumentError] Raises if hosts_file_path is not a valid YAML file
15
+ # @raise [Errno::ENOENT] File not found error: hosts_file doesn't exist
15
16
  def self.parse_hosts_file(hosts_file_path = nil)
17
+ host_options = new_host_options
18
+ return host_options unless hosts_file_path
19
+ error_message = "#{hosts_file_path} is not a valid YAML file\n\t"
20
+ host_options = self.merge_hosts_yaml( host_options, error_message ) {
21
+ hosts_file_path = File.expand_path( hosts_file_path )
22
+ YAML.load_file( hosts_file_path )
23
+ }
24
+ fix_roles_array( host_options )
25
+ end
26
+
27
+ # Read the contents of a host definition as a string into an OptionsHash
28
+ #
29
+ # @param [String] hosts_def_yaml YAML hosts definition
30
+ #
31
+ # @return [OptionsHash] Contents of the hosts file as an OptionsHash
32
+ # @raise [ArgumentError] If hosts_def_yaml is not a valid YAML string
33
+ def self.parse_hosts_string(hosts_def_yaml = nil)
34
+ host_options = new_host_options
35
+ return host_options unless hosts_def_yaml
36
+ error_message = "#{hosts_def_yaml}\nis not a valid YAML string\n\t"
37
+ host_options = self.merge_hosts_yaml( host_options, error_message ) {
38
+ YAML.load( hosts_def_yaml )
39
+ }
40
+ fix_roles_array( host_options )
41
+ end
42
+
43
+ # Convenience method to create new OptionsHashes with a HOSTS section
44
+ #
45
+ # @return [OptionsHash] Hash with HOSTS section
46
+ def self.new_host_options
16
47
  host_options = Beaker::Options::OptionsHash.new
17
48
  host_options['HOSTS'] ||= {}
18
- unless hosts_file_path
19
- return host_options
20
- end
21
- hosts_file_path = File.expand_path(hosts_file_path)
22
- unless File.exists?(hosts_file_path)
23
- raise ArgumentError, "Host file '#{hosts_file_path}' does not exist!"
24
- end
25
- begin
26
- host_options = host_options.merge(YAML.load_file(hosts_file_path))
27
- rescue Psych::SyntaxError => e
28
- raise ArgumentError, "#{hosts_file_path} is not a valid YAML file\n\t#{e}"
29
- end
49
+ host_options
50
+ end
30
51
 
31
- # Make sure the roles array is present for all hosts
52
+ # Make sure the roles array is present for all hosts
53
+ #
54
+ def self.fix_roles_array( host_options )
32
55
  host_options['HOSTS'].each_key do |host|
33
56
  host_options['HOSTS'][host]['roles'] ||= []
34
57
  end
@@ -38,6 +61,23 @@ module Beaker
38
61
  host_options
39
62
  end
40
63
 
64
+ # Merges YAML read in the passed block into given OptionsHash
65
+ #
66
+ # @param [OptionsHash] host_options Host information hash
67
+ # @param [String] error_message Message to print if {::Psych::SyntaxError}
68
+ # is raised during block execution
69
+ # @return [OptionsHash] Updated host_options with host info merged
70
+ def self.merge_hosts_yaml( host_options, error_message, &block )
71
+ begin
72
+ loaded_host_options = yield
73
+ rescue Psych::SyntaxError => e
74
+ error_message << e.to_s
75
+ raise ArgumentError, error_message
76
+ end
77
+
78
+ host_options.merge( loaded_host_options )
79
+ end
80
+
41
81
  end
42
82
  end
43
83
  end
@@ -90,7 +90,9 @@ module Beaker
90
90
  # @return nil
91
91
  # @api public
92
92
  def resolve_symlinks!
93
- @options[:hosts_file] = File.realpath(@options[:hosts_file]) if @options[:hosts_file]
93
+ if @options[:hosts_file] && !@options[:hosts_file_generated]
94
+ @options[:hosts_file] = File.realpath(@options[:hosts_file])
95
+ end
94
96
  end
95
97
 
96
98
  #Converts array of paths into array of fully qualified git repo URLS with expanded keywords
@@ -192,8 +194,7 @@ module Beaker
192
194
  @options = @options.merge(cmd_line_and_file_options)
193
195
 
194
196
  if not @options[:help] and not @options[:beaker_version_print]
195
- #read the hosts file that contains the node configuration and hypervisor info
196
- hosts_options = Beaker::Options::HostsFileParser.parse_hosts_file(@options[:hosts_file])
197
+ hosts_options = parse_hosts_options
197
198
 
198
199
  # merge in host file vars
199
200
  # overwrite options (default, file options, command line) with host file options
@@ -215,6 +216,39 @@ module Beaker
215
216
  @options
216
217
  end
217
218
 
219
+ # Parse hosts options from host files into a host options hash. Falls back
220
+ # to trying as a beaker-hostgenerator string if reading the hosts file
221
+ # doesn't work
222
+ #
223
+ # @return [Hash] Host options, containing all host-specific details
224
+ # @raise [ArgumentError] if a hosts file is generated, but it can't
225
+ # be read by the HostsFileParser
226
+ def parse_hosts_options
227
+ if File.exists?(@options[:hosts_file])
228
+ #read the hosts file that contains the node configuration and hypervisor info
229
+ return Beaker::Options::HostsFileParser.parse_hosts_file(@options[:hosts_file])
230
+ end
231
+
232
+ dne_message = "\nHosts file '#{@options[:hosts_file]}' does not exist."
233
+ dne_message << "\nTrying as beaker-hostgenerator input.\n\n"
234
+ $stdout.puts dne_message
235
+ require 'beaker-hostgenerator'
236
+
237
+ hosts_file_content = begin
238
+ bhg_cli = BeakerHostGenerator::CLI.new( [ @options[:hosts_file] ] )
239
+ bhg_cli.execute
240
+ rescue BeakerHostGenerator::Exceptions::Error,
241
+ BeakerHostGenerator::Exceptions::InvalidNodeSpecError => error
242
+ error_message = "\nbeaker-hostgenerator was not able to use this value as input."
243
+ error_message << "\nExiting with an Error.\n\n"
244
+ $stderr.puts error_message
245
+ raise error
246
+ end
247
+
248
+ @options[:hosts_file_generated] = true
249
+ Beaker::Options::HostsFileParser.parse_hosts_string( hosts_file_content )
250
+ end
251
+
218
252
  #Validate all merged options values for correctness
219
253
  #
220
254
  #Currently checks:
@@ -165,9 +165,9 @@ module Beaker
165
165
  :repo_proxy => false,
166
166
  :package_proxy => false,
167
167
  :add_el_extras => false,
168
- :epel_url => "http://mirrors.kernel.org/fedora-epel",
168
+ :epel_url => "http://dl.fedoraproject.org/pub/epel",
169
169
  :epel_arch => "i386",
170
- :epel_7_pkg => "epel-release-7-6.noarch.rpm",
170
+ :epel_7_pkg => "epel-release-7-7.noarch.rpm",
171
171
  :epel_6_pkg => "epel-release-6-8.noarch.rpm",
172
172
  :epel_5_pkg => "epel-release-5-4.noarch.rpm",
173
173
  :consoleport => 443,
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.44.0'
3
+ STRING = '2.45.0'
4
4
  end
5
5
  end
@@ -2,7 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  module Beaker
4
4
  describe CLI do
5
- let(:cli) { Beaker::CLI.new }
5
+ let(:cli) {
6
+ allow(File).to receive(:exists?).and_return(true)
7
+ Beaker::CLI.new
8
+ }
6
9
 
7
10
  context 'execute!' do
8
11
  before :each do
@@ -1110,68 +1110,45 @@ describe ClassMixedWithDSLInstallUtils do
1110
1110
  end
1111
1111
 
1112
1112
  describe '#remove_puppet_on' do
1113
- let(:aixhost) { make_host('aix', :platform => 'aix-53-power') }
1114
- let(:sol10host) { make_host('sol10', :platform => 'solaris-10-x86_64') }
1115
- let(:sol11host) { make_host('sol11', :platform => 'solaris-11-x86_64') }
1116
- let(:cumulushost) { make_host('cumulus', :platform => 'cumulus-2.2-amd64') }
1117
- let(:el6host) { make_host('el6', :platform => 'el-6-x64') }
1118
-
1119
- pkg_list = 'foo bar'
1120
-
1121
- it 'uninstalls packages on aix' do
1122
- result = Beaker::Result.new(aixhost,'')
1123
- result.stdout = pkg_list
1124
-
1125
- expected_list = pkg_list
1126
- cmd_args = ''
1127
-
1128
- expect( subject ).to receive(:on).exactly(2).times.and_return(result, result)
1129
- expect( aixhost ).to receive(:uninstall_package).with(expected_list, cmd_args)
1130
-
1131
- subject.remove_puppet_on( aixhost )
1132
- end
1133
-
1134
- it 'uninstalls packages on solaris 10' do
1135
- result = Beaker::Result.new(sol10host,'')
1136
- result.stdout = pkg_list
1137
-
1138
- expected_list = pkg_list
1139
- cmd_args = '-a noask'
1140
-
1141
- expect( subject ).to receive(:on).exactly(2).times.and_return(result, result)
1142
- expect( sol10host ).to receive(:uninstall_package).with(expected_list, cmd_args)
1143
-
1144
- subject.remove_puppet_on( sol10host )
1145
- end
1146
-
1147
- it 'uninstalls packages on solaris 11' do
1148
- result = Beaker::Result.new(sol11host,'')
1149
- result.stdout='foo bar'
1150
-
1151
- expected_list = pkg_list
1152
- cmd_args = ''
1153
-
1154
- expect( subject ).to receive(:on).exactly(4).times.and_return(result, result, result)
1155
- expect( sol11host ).to receive(:uninstall_package).with(expected_list, cmd_args)
1156
-
1157
- subject.remove_puppet_on( sol11host )
1158
- end
1159
-
1160
- it 'uninstalls packages on cumulus' do
1161
- result = Beaker::Result.new(cumulushost,'')
1162
- result.stdout = pkg_list
1163
-
1164
- expected_list = pkg_list
1165
- cmd_args = ''
1166
-
1167
- expect( subject ).to receive(:on).exactly(2).times.and_return(result, result)
1168
- expect( cumulushost ).to receive(:uninstall_package).with(expected_list, cmd_args)
1169
-
1170
- subject.remove_puppet_on( cumulushost )
1113
+ supported_platforms = [ 'aix-53-power',
1114
+ 'aix-61-power',
1115
+ 'aix-71-power',
1116
+ 'solaris-10-x86_64',
1117
+ 'solaris-10-x86_64',
1118
+ 'solaris-11-x86_64',
1119
+ 'cumulus-2.2-amd64',
1120
+ 'el-6-x86_64',
1121
+ 'redhat-7-x86_64',
1122
+ 'centos-7-x86_64',
1123
+ 'oracle-7-x86_64',
1124
+ 'scientific-7-x86_64',
1125
+ 'sles-10-x86_64',
1126
+ 'sles-11-x86_64',
1127
+ 'sles-12-s390x'
1128
+ ]
1129
+
1130
+ supported_platforms.each do |platform|
1131
+ let(:host) { make_host(platform, :platform => platform) }
1132
+
1133
+ pkg_list = 'foo bar'
1134
+
1135
+ it "uninstalls packages on #{platform}" do
1136
+ result = Beaker::Result.new(host,'')
1137
+ result.stdout = pkg_list
1138
+
1139
+ expected_list = pkg_list
1140
+ cmd_args = ''
1141
+
1142
+ expect( subject ).to receive(:on).exactly(2).times.and_return(result, result)
1143
+ expect( host ).to receive(:uninstall_package).with(expected_list, cmd_args)
1144
+
1145
+ subject.remove_puppet_on( host )
1146
+ end
1171
1147
  end
1172
1148
 
1173
- it 'raises error on other platforms' do
1174
- expect { subject.remove_puppet_on( el6host ) }.to raise_error(RuntimeError, /unsupported platform/)
1149
+ let(:ubuntu12) { make_host('ubuntu-1204-amd64', :platform => 'ubuntu-1204-amd64') }
1150
+ it 'raises error on unsupported platforms' do
1151
+ expect { subject.remove_puppet_on( ubuntu12 ) }.to raise_error(RuntimeError, /unsupported platform/)
1175
1152
  end
1176
1153
 
1177
1154
  end