beaker 2.50.0 → 2.51.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzlmMWE0ZTZiMmI4MmE4YmNkMTk1MmIwMGRmNTFiYmI1YWZkNThiNg==
4
+ NGUxMzhiNjE1NjU1NjRjZGRkMTllMjA1NjExYTMwNmFiZDI4MjNjMA==
5
5
  data.tar.gz: !binary |-
6
- OGIyMjM5NTA0MGY4OGU2NjU0Mjk2MWZmMTM2OWZhNjYyMTEyNDk0ZA==
6
+ MDNkNjAyNmQzODM4MTk1NDQwNjgxODE0NDFhM2Q2NDFiOWQwZGU1Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NmY1Y2M3YTMzMWY4NzM4ODY4NzFmMmI1ZjIwZWVkOTY4MTIyZGFkMWQ2MzY2
10
- ZTE5OWFiZGYwY2I3MGQ5NmYwM2I4YzJlMzc1NDMwNWE2YjM1ODViOTc3ODMw
11
- NDZlZTE0ZmQ0OWM5MjlkOTQ2MzBlYmQ2OThmNzBkNWI4OTBmN2Q=
9
+ MTFjMWU2NWViNDJlOWQ5Njk4N2IyZDY3MWI0MWFiNTRlZTE4ZmRlYTEwZjk3
10
+ ZmZjODBhNGFkYmRmZTMwZjJhYWEwMTJkNzkwZTMzN2UyY2ZmMDI2OTBhMWFm
11
+ MzdiNGU2YTFiNjgwYzEzODFmNjY5MjNjZWNiMjRlY2I4ZGZjYTc=
12
12
  data.tar.gz: !binary |-
13
- ZjMxMDlhYzcxZTk1ZDE0ODQ0ZDZiNzdiMWU2YjA0NjZjZGM2NzE3ODFkNGJk
14
- OGQ4M2YzNDQwNGYyNTk1NGJkYWYwNTNhOThmZDhhMDRjNDM5YzY5MDFjYTQ5
15
- MzZhNjY4MDhiMzcwOGZjMmM1YmJjZGE4ZWRhNjEyMjEyMDg5ZWI=
13
+ MTlhYmM2ZjdjN2ZkZmI3Mjc2MzI0YTkyYzY5Yzg1YzY3MTFhM2Y4YWUyOGYx
14
+ YmI3ZWQ2NDZjYzNjNGEyOGZiYjNhNjVkNTczOTE5ZDUzNjdiYjk0MDUxODJj
15
+ ZTU3MDY5NWZlZTAzNTU1NjQwODZiYTY1YmQ3MzI4MDc0OTk5YWY=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 22 Aug, 2016 (9358f2eb)](#LATEST)
3
+ * [LATEST - 7 Sep, 2016 (fb109bdc)](#LATEST)
4
+ * [2.50.0 - 22 Aug, 2016 (1f003a4d)](#2.50.0)
4
5
  * [2.49.0 - 11 Aug, 2016 (53ba3f14)](#2.49.0)
5
6
  * [2.48.1 - 29 Jul, 2016 (e5a52ad4)](#2.48.1)
6
7
  * [2.48.0 - 27 Jul, 2016 (47d3aa18)](#2.48.0)
@@ -128,7 +129,158 @@
128
129
  * [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
129
130
 
130
131
  ## Details
131
- ### <a name = "LATEST">LATEST - 22 Aug, 2016 (9358f2eb)
132
+ ### <a name = "LATEST">LATEST - 7 Sep, 2016 (fb109bdc)
133
+
134
+ * (GEM) update beaker version to 2.51.0 (fb109bdc)
135
+
136
+ * Merge pull request #1237 from tvpartytonight/maint_maintainers (45a9c88d)
137
+
138
+
139
+ ```
140
+ Merge pull request #1237 from tvpartytonight/maint_maintainers
141
+
142
+ (maint) Add MAINTAINERS
143
+ ```
144
+ * (maint) Add MAINTAINERS (f7d491fb)
145
+
146
+ * Merge pull request #1232 from ferglor/BKR-888 (0e13b888)
147
+
148
+
149
+ ```
150
+ Merge pull request #1232 from ferglor/BKR-888
151
+
152
+ (BKR-888) install_puppet_agent_dev_repo_on prohibits passing different platforms
153
+ ```
154
+ * Merge pull request #1235 from puppetlabs/revert-1233-bkr712_fix_preset (c0c69370)
155
+
156
+
157
+ ```
158
+ Merge pull request #1235 from puppetlabs/revert-1233-bkr712_fix_preset
159
+
160
+ Revert "(BKR-712) changed default to not cache files locally"
161
+ ```
162
+ * Revert "(BKR-712) changed default to not cache files locally" (94e500b7)
163
+
164
+ * Merge pull request #1220 from mmckinst/ENV_containter_docker (6d627526)
165
+
166
+
167
+ ```
168
+ Merge pull request #1220 from mmckinst/ENV_containter_docker
169
+
170
+ (BKR-528) Set ENV container docker
171
+ ```
172
+ * (maint) Add security group option to openstack hypervisor initialization (#1229) (fff68bbb)
173
+
174
+
175
+ ```
176
+ (maint) Add security group option to openstack hypervisor initialization (#1229)
177
+
178
+ * Add security group option to openstack hypervisor
179
+
180
+ * Setting hostname working
181
+
182
+ * Update docs for sec group
183
+
184
+ * Add spec tests for security group option
185
+
186
+ * Adjust docs
187
+ ```
188
+ * Merge pull request #1233 from kevpl/bkr712_fix_preset (391730f0)
189
+
190
+
191
+ ```
192
+ Merge pull request #1233 from kevpl/bkr712_fix_preset
193
+
194
+ (BKR-712) changed default to not cache files locally
195
+ ```
196
+ * Merge pull request #1230 from kevpl/maint_maintainer_clarify (ff45ff66)
197
+
198
+
199
+ ```
200
+ Merge pull request #1230 from kevpl/maint_maintainer_clarify
201
+
202
+ (MAINT) clarify reviewer vs maintainer roles
203
+ ```
204
+ * (BKR-712) changed default to not cache files locally (9c276bba)
205
+
206
+ * (MAINT) clarify reviewer vs maintainer roles (4f8d322e)
207
+
208
+
209
+ ```
210
+ (MAINT) clarify reviewer vs maintainer roles
211
+
212
+ [skip ci]
213
+ ```
214
+ * Merge pull request #1215 from petems/BKR-907-custom_vagrantfile_provisioner (5c66ae6f)
215
+
216
+
217
+ ```
218
+ Merge pull request #1215 from petems/BKR-907-custom_vagrantfile_provisioner
219
+
220
+ (BKR-907) Add vagrant_custom hypervisor
221
+ ```
222
+ * (BKR-888) install_puppet_agent_dev_repo_on design prohibits passing hosts of different platforms (253e20c1)
223
+
224
+ * Merge pull request #1225 from tvpartytonight/BKR-916 (0601467d)
225
+
226
+
227
+ ```
228
+ Merge pull request #1225 from tvpartytonight/BKR-916
229
+
230
+ (BKR-916) Use dns_name for ec2 hostnames
231
+ ```
232
+ * (BKR-916) Use dns_name for ec2 hostnames (a5bbdab2)
233
+
234
+
235
+ ```
236
+ (BKR-916) Use dns_name for ec2 hostnames
237
+
238
+ Prior to this change, provisioning in ec2 would set each host's hostname
239
+ to the `name` attribute of the host. This change removes that behavior
240
+ and sets each host's hostname to be the public facing `dns_name`
241
+ provided by ec2 to allow traffic from outside ec2 to route correctly to
242
+ that host.
243
+ ```
244
+ * (BKR-528) Set ENV container docker (9dcc8079)
245
+
246
+
247
+ ```
248
+ (BKR-528) Set ENV container docker
249
+
250
+ See below relevant links:
251
+
252
+ * https://github.com/test-kitchen/kitchen-docker/pull/192
253
+ * https://github.com/test-kitchen/kitchen-docker/pull/216
254
+ * https://developerblog.redhat.com/2014/05/05/running-systemd-within-docker-container/
255
+ ```
256
+ * (BKR-907) Add vagrant_custom hypervisor (bb596fa1)
257
+
258
+
259
+ ```
260
+ (BKR-907) Add vagrant_custom hypervisor
261
+
262
+ * Gives the ability to specify users own Vagrantfile
263
+ * Useful if there's a bug in beaker, you have a custom Vagrant provider missing from Beaker...
264
+ * or you just want to be super explicit about your Vagrantfile
265
+ * Example:
266
+
267
+
268
+
269
+ HOSTS:
270
+ trusty:
271
+ roles:
272
+ - apache
273
+ platform: ubuntu-1404-x86_64
274
+ hypervisor: vagrant_custom
275
+ box: trusty64
276
+ CONFIG:
277
+ vagrantfile_path: /opt/testing/CustomVagrantfile
278
+
279
+
280
+ ```
281
+ ### <a name = "2.50.0">2.50.0 - 22 Aug, 2016 (1f003a4d)
282
+
283
+ * (HISTORY) update beaker history for gem release 2.50.0 (1f003a4d)
132
284
 
133
285
  * (GEM) update beaker version to 2.50.0 (9358f2eb)
134
286
 
@@ -0,0 +1,28 @@
1
+ {
2
+ "version": 1,
3
+ "file_format": "This MAINTAINERS file format is described at https://github.com/puppetlabs/maintainers",
4
+ "issues": "https://tickets.puppet.com/browse/BKR",
5
+ "people": [
6
+ {
7
+ "github": "kevpl",
8
+ "email": "ki@puppet.com",
9
+ "name": "Kevin Imber"
10
+ },
11
+ {
12
+ "github": "tvpartytonight",
13
+ "email": "tv@puppet.com",
14
+ "name": "Tony Vu"
15
+ },
16
+ {
17
+ "github": "pinkypie",
18
+ "email": "sarah@puppet.com",
19
+ "name": "Sarah Thompson"
20
+ },
21
+ {
22
+ "github": "ferglor",
23
+ "email": "fergal@puppet.com",
24
+ "name": "Fergal Gribben"
25
+ }
26
+ ]
27
+ }
28
+
@@ -1,4 +1,4 @@
1
- # Reviewers/Maintainers For Beaker
1
+ # Maintainers For Beaker
2
2
 
3
3
  Beaker is maintained by Puppet's Quality Engineering (QE) Team. These people
4
4
  will be reviewing & merging PRs to the project.
@@ -7,12 +7,13 @@ In particular, our current Beaker maintainers are:
7
7
  | Name | Github | Email |
8
8
  |:--------------:|:---------------------------------------------------:|:--------------------:|
9
9
  | Kevin Imber | [kevpl](https://github.com/kevpl) | <ki@puppet.com> |
10
- | Tony Vu | [tvpartytonight](https://github.com/tvpartytonight) | <tony.vu@puppet.com> |
10
+ | Tony Vu | [tvpartytonight](https://github.com/tvpartytonight) | <tv@puppet.com> |
11
11
  | Sarah Thompson | [pinkypie](https://github.com/pinkypie) | <sarah@puppet.com> |
12
+ | Fergal Gribben | [ferglor](https://github.com/ferglor) | <ferglor@puppet.com> |
12
13
 
13
- # Reviewers/Maintainers For Specific Areas of Beaker
14
+ # Reviewers For Specific Areas of Beaker
14
15
 
15
- For code to land in these specific areas of Beaker the following owners must provide review and :+1:
16
+ For code to land in these specific areas of Beaker the following people must provide review and :+1:
16
17
 
17
18
  Code | Owners
18
19
  :-------:|:----------:
@@ -105,4 +105,12 @@ Also if you plan use `user-data` make sure that 'cloud-init' package installed i
105
105
  openstack_network : testing
106
106
  openstack_keyname : nopass
107
107
 
108
+ ### Security groups
108
109
 
110
+ A security group is a set of rules for incoming and outgoing traffic to
111
+ an instance. You can associate a host with one or many security groups
112
+ in the `CONFIG` section of your hosts file:
113
+
114
+ security_group: ['my_sg', 'default']
115
+
116
+ This is an optional config parameter.
@@ -1068,12 +1068,11 @@ module Beaker
1068
1068
  opts = FOSS_DEFAULT_DOWNLOAD_URLS.merge(opts)
1069
1069
  opts[:download_url] = "#{opts[:dev_builds_url]}/puppet-agent/#{ opts[:puppet_agent_sha] || opts[:puppet_agent_version] }/repos/"
1070
1070
  opts[:copy_base_local] ||= File.join('tmp', 'repo_configs')
1071
- opts[:copy_dir_external] ||= host.external_copy_base
1072
1071
  opts[:puppet_collection] ||= 'PC1'
1073
1072
  add_role(host, 'aio') #we are installing agent, so we want aio role
1074
1073
  release_path = opts[:download_url]
1075
1074
  copy_dir_local = File.join(opts[:copy_base_local], variant)
1076
- onhost_copy_base = opts[:copy_dir_external]
1075
+ onhost_copy_base = opts[:copy_dir_external] || host.external_copy_base
1077
1076
 
1078
1077
  case variant
1079
1078
  when /^(fedora|el|centos|debian|ubuntu|cumulus|huaweios|cisco_nexus|cisco_ios_xr)$/
@@ -1100,7 +1099,7 @@ module Beaker
1100
1099
  release_path << release_path_end
1101
1100
  logger.trace("#install_puppet_agent_dev_repo_on: dev_package_info, continuing...")
1102
1101
 
1103
- if host['platform'] =~ /eos/
1102
+ if variant =~ /eos/
1104
1103
  host.get_remote_file( "#{release_path}/#{release_file}" )
1105
1104
  else
1106
1105
  onhost_copied_file = File.join(onhost_copy_base, release_file)
@@ -41,6 +41,8 @@ module Beaker
41
41
  end
42
42
  when /^vagrant$/
43
43
  Beaker::Vagrant
44
+ when /^vagrant_custom$/
45
+ Beaker::VagrantCustom
44
46
  when /^vagrant_libvirt$/
45
47
  Beaker::VagrantLibvirt
46
48
  when /^vagrant_virtualbox$/
@@ -147,6 +149,6 @@ module Beaker
147
149
  end
148
150
  end
149
151
 
150
- [ 'vsphere_helper', 'vagrant', 'vagrant_virtualbox', 'vagrant_parallels', 'vagrant_libvirt', 'vagrant_fusion', 'vagrant_workstation', 'fusion', 'aws_sdk', 'vsphere', 'vmpooler', 'vcloud', 'aixer', 'solaris', 'docker', 'google_compute', 'openstack', 'noop' ].each do |lib|
152
+ [ 'vsphere_helper', 'vagrant', 'vagrant_custom', 'vagrant_virtualbox', 'vagrant_parallels', 'vagrant_libvirt', 'vagrant_fusion', 'vagrant_workstation', 'fusion', 'aws_sdk', 'vsphere', 'vmpooler', 'vcloud', 'aixer', 'solaris', 'docker', 'google_compute', 'openstack', 'noop' ].each do |lib|
151
153
  require "beaker/hypervisor/#{lib}"
152
154
  end
@@ -630,19 +630,21 @@ module Beaker
630
630
  @logger.notify("netscaler: nsroot password is #{host['instance'].id}")
631
631
  end
632
632
 
633
- # Set the hostname of all instances to be the hostname defined in the
634
- # beaker configuration.
633
+ # Set the :vmhostname for each host object to be the dns_name, which is accessible
634
+ # publicly. Then configure each ec2 machine to that dns_name, so that when facter
635
+ # is installed the facts for hostname and domain match the dns_name.
635
636
  #
636
- # @return [void]
637
+ # @return [@hosts]
637
638
  # @api private
638
639
  def set_hostnames
639
640
  @hosts.each do |host|
641
+ host[:vmhostname] = host[:dns_name]
640
642
  if host['platform'] =~ /el-7/
641
643
  # on el-7 hosts, the hostname command doesn't "stick" randomly
642
- host.exec(Command.new("hostnamectl set-hostname #{host.name}"))
644
+ host.exec(Command.new("hostnamectl set-hostname #{host.hostname}"))
643
645
  else
644
646
  next if host['platform'] =~ /netscaler/
645
- host.exec(Command.new("hostname #{host.name}"))
647
+ host.exec(Command.new("hostname #{host.hostname}"))
646
648
  end
647
649
  end
648
650
  end
@@ -192,6 +192,7 @@ module Beaker
192
192
  # specify base image
193
193
  dockerfile = <<-EOF
194
194
  FROM #{host['image']}
195
+ ENV container docker
195
196
  EOF
196
197
 
197
198
  # additional options to specify to the sshd
@@ -16,6 +16,7 @@ module Beaker
16
16
  #@option options [String] :openstack_region The region that each OpenStack instance should be provisioned on (optional)
17
17
  #@option options [String] :openstack_network The network that each OpenStack instance should be contacted through (required)
18
18
  #@option options [String] :openstack_keyname The name of an existing key pair that should be auto-loaded onto each
19
+ #@option options [Hash] :security_group An array of security groups to associate with the instance
19
20
  # OpenStack instance (optional)
20
21
  #@option options [String] :jenkins_build_url Added as metadata to each OpenStack instance
21
22
  #@option options [String] :department Added as metadata to each OpenStack instance
@@ -88,6 +89,18 @@ module Beaker
88
89
  @network_client.networks.find { |x| x.name == n } || raise("Couldn't find network: #{n}")
89
90
  end
90
91
 
92
+ #Provided an array of security groups return that array if all
93
+ #security groups are present
94
+ #@param [Array] sgs The array of security group names
95
+ #@return [Array] The array of security group names
96
+ def security_groups sgs
97
+ for sg in sgs
98
+ @logger.debug "Openstack: Looking up security group '#{sg}'"
99
+ @compute_client.security_groups.find { |x| x.name == sg } || raise("Couldn't find security group: #{sg}")
100
+ sgs
101
+ end
102
+ end
103
+
91
104
  # Create a volume client on request
92
105
  # @return [Fog::OpenStack::Volume] OpenStack volume client
93
106
  def volume_client_create
@@ -102,10 +115,10 @@ module Beaker
102
115
  @volume_client ||= Fog::Volume.new(options)
103
116
  unless @volume_client
104
117
  raise "Unable to create OpenStack Volume instance"\
105
- " (api_key: #{@options[:openstack_api_key]},"\
106
- " username: #{@options[:openstack_username]},"\
107
- " auth_url: #{@options[:openstack_auth_url]},"\
108
- " tenant: #{@options[:openstack_tenant]})"
118
+ " (api_key: #{@options[:openstack_api_key]},"\
119
+ " username: #{@options[:openstack_username]},"\
120
+ " auth_url: #{@options[:openstack_auth_url]},"\
121
+ " tenant: #{@options[:openstack_tenant]})"
109
122
  end
110
123
  end
111
124
 
@@ -158,21 +171,35 @@ module Beaker
158
171
  end
159
172
  end
160
173
 
174
+ def get_ip
175
+ ip = @compute_client.addresses.find { |ip| ip.instance_id.nil? }
176
+ if ip.nil?
177
+ @logger.debug "Creating IP"
178
+ ip = @compute_client.addresses.create
179
+ end
180
+ ip
181
+ end
182
+
183
+
161
184
  #Create new instances in OpenStack
162
185
  def provision
163
186
  @logger.notify "Provisioning OpenStack"
164
187
 
165
188
  @hosts.each do |host|
166
- host[:vmhostname] = generate_host_name
189
+ ip = get_ip
190
+ hostname = ip.ip.gsub! '.','-'
191
+ host[:vmhostname] = hostname+'.rfc1918.puppetlabs.net'
167
192
  @logger.debug "Provisioning #{host.name} (#{host[:vmhostname]})"
168
193
  options = {
169
194
  :flavor_ref => flavor(host[:flavor]).id,
170
195
  :image_ref => image(host[:image]).id,
171
196
  :nics => [ {'net_id' => network(@options[:openstack_network]).id } ],
172
197
  :name => host[:vmhostname],
198
+ :hostname => host[:vmhostname],
173
199
  :user_data => host[:user_data] || "#cloud-config\nmanage_etc_hosts: true\n",
174
200
  }
175
201
  options[:key_name] = key_name(host)
202
+ options[:security_groups] = security_groups(@options[:security_group]) unless @options[:security_group].nil?
176
203
  vm = @compute_client.servers.create(options)
177
204
 
178
205
  #wait for the new instance to start up
@@ -204,11 +231,7 @@ module Beaker
204
231
  begin
205
232
  # Here we try and assign an address from a floating IP pool
206
233
  # This seems to fail on some implementations (FloatingIpPoolNotFound)
207
- ip = @compute_client.addresses.find { |ip| ip.instance_id.nil? }
208
- if ip.nil?
209
- @logger.debug "Creating IP for #{host.name} (#{host[:vmhostname]})"
210
- ip = @compute_client.addresses.create
211
- end
234
+ ip.ip.gsub! '-','.'
212
235
  ip.server = vm
213
236
  address = ip.ip
214
237
 
@@ -0,0 +1,11 @@
1
+ require 'beaker/hypervisor/vagrant'
2
+
3
+ class Beaker::VagrantCustom < Beaker::Vagrant
4
+ def provision(provider = nil)
5
+ super
6
+ end
7
+
8
+ def make_vfile hosts, options = {}
9
+ FileUtils.cp(@options[:vagrantfile_path], @vagrant_file)
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.50.0'
3
+ STRING = '2.51.0'
4
4
  end
5
5
  end
@@ -1059,7 +1059,7 @@ describe ClassMixedWithDSLInstallUtils do
1059
1059
  # install_puppetlabs_dev_repo route
1060
1060
  platform = Object.new()
1061
1061
  allow( platform ).to receive( :to_array ) { ['eos', '5', 'x4'] }
1062
- host = basic_hosts.first
1062
+ host = eoshost
1063
1063
  host['platform'] = platform
1064
1064
  sha_value = 'dahdahdahdah'
1065
1065
  copy_base_local_override = 'face'
@@ -1072,10 +1072,7 @@ describe ClassMixedWithDSLInstallUtils do
1072
1072
 
1073
1073
  allow( host ).to receive( :puppet_agent_dev_package_info ).and_return( ['', ''] )
1074
1074
 
1075
- expect( subject ).to receive( :fetch_http_file ).once.with(
1076
- anything, anything, /^#{copy_base_local_override}/ )
1077
- expect( subject ).to receive( :scp_to ).once.with(
1078
- host, /#{copy_base_local_override}/, anything )
1075
+ allow( host ).to receive( :get_remote_file).once.with(anything)
1079
1076
  allow( host ).to receive( :install_from_file )
1080
1077
 
1081
1078
  subject.install_puppet_agent_dev_repo_on( host, opts )
@@ -1110,6 +1107,92 @@ describe ClassMixedWithDSLInstallUtils do
1110
1107
  expect( subject ).to receive( :fetch_http_file ).with( /[^\/]\z/, anything, anything )
1111
1108
  subject.install_puppet_agent_dev_repo_on( host, opts.merge({ :puppet_agent_version => '1.0.0' }) )
1112
1109
  end
1110
+
1111
+ it 'installs on different hosts without erroring' do
1112
+ mhosts = hosts
1113
+ mhosts[3] = eoshost
1114
+
1115
+ mhosts.each_with_index do |host, index|
1116
+ platform = Object.new()
1117
+ if index == 0
1118
+ allow(platform).to receive(:to_array) { ['solaris', '5', 'x4']}
1119
+ allow(host).to receive(:external_copy_base) {'/host0'}
1120
+ elsif index == 1
1121
+ allow(platform).to receive(:to_array) { ['windows', '5', 'x4']}
1122
+ allow(host).to receive(:external_copy_base) {'/host1'}
1123
+ elsif index == 2
1124
+ allow(platform).to receive(:to_array) { ['osx', '5', 'x4']}
1125
+ allow(host).to receive(:external_copy_base) {'/host2'}
1126
+ elsif index == 3
1127
+ allow(platform).to receive(:to_array) { ['eos', '5', 'x4']}
1128
+ allow(host).to receive(:external_copy_base) {'/host3'}
1129
+ end
1130
+ host['platform'] = platform
1131
+ allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return(["test", "blah"])
1132
+ end
1133
+
1134
+ expect( subject ).to receive(:add_role).with( any_args ).exactly(mhosts.length).times
1135
+
1136
+ expect( subject ).to receive(:fetch_http_file).with( any_args ).exactly(3).times
1137
+ expect( subject ).to receive(:scp_to).with( any_args ).exactly(3).times
1138
+
1139
+ expect( subject ).to receive(:install_msi_on).with( mhosts[1], 'xyz', {}, anything).exactly(1).times
1140
+ expect( mhosts[0] ).to receive(:solaris_install_local_package).with( "blah", "/host0" ).exactly(1).times
1141
+ expect( mhosts[2] ).to receive(:install_package).with( any_args ).exactly(1).times
1142
+ expect( mhosts[3] ).to receive(:install_from_file).with( "blah" ).exactly(1).times
1143
+
1144
+ result = object_double(Beaker::Result.new({}, "foo"), :raw_output=> "xyz")
1145
+ allow(subject).to receive(:on).with(mhosts[1], anything).and_return(result)
1146
+
1147
+ expect( subject ).to receive(:configure_type_defaults_on).with( any_args ).exactly(mhosts.length).times
1148
+
1149
+ subject.install_puppet_agent_dev_repo_on( mhosts, opts.merge({:puppet_agent_version => '1.0.0' }) )
1150
+ end
1151
+
1152
+ it 'installs on different hosts with options specifying :copy_dir_external' do
1153
+ mhosts = hosts
1154
+ mhosts[3] = eoshost
1155
+
1156
+ mhosts.each_with_index do |host, index|
1157
+ platform = Object.new()
1158
+ if index == 0
1159
+ allow(platform).to receive(:to_array) { ['solaris', '5', 'x4']}
1160
+ allow(host).to receive(:external_copy_base) {'/host0'}
1161
+ elsif index == 1
1162
+ allow(platform).to receive(:to_array) { ['windows', '5', 'x4']}
1163
+ allow(host).to receive(:external_copy_base) {'/host1'}
1164
+ elsif index == 2
1165
+ allow(platform).to receive(:to_array) { ['osx', '5', 'x4']}
1166
+ allow(host).to receive(:external_copy_base) {'/host2'}
1167
+ elsif index == 3
1168
+ allow(platform).to receive(:to_array) { ['eos', '5', 'x4']}
1169
+ allow(host).to receive(:external_copy_base) {'/host3'}
1170
+ end
1171
+ allow(host).to receive(:puppet_agent_dev_package_info).with(any_args).and_return(["test", "/blah"])
1172
+ host['platform'] = platform
1173
+ end
1174
+
1175
+ expect( subject ).to receive(:add_role).with( any_args ).exactly(mhosts.length).times
1176
+
1177
+ expect( subject ).to receive(:fetch_http_file).with( any_args ).exactly(3).times
1178
+ expect( subject ).to receive(:scp_to).with( any_args ).exactly(3).times
1179
+
1180
+ expect( subject ).to receive(:install_msi_on).with(mhosts[1], 'xyz', {}, anything ).exactly(1).times
1181
+ expect( mhosts[0] ).to receive(:solaris_install_local_package).with( '/blah', '/tmp').exactly(1).times
1182
+ expect( mhosts[2] ).to receive(:install_package).with( any_args ).exactly(1).times
1183
+ expect( mhosts[3] ).to receive(:install_from_file).with( '/blah').exactly(1).times
1184
+ expect( mhosts[0] ).to receive(:external_copy_base).with( no_args ).exactly(0).times
1185
+ expect( mhosts[1] ).to receive(:external_copy_base).with( no_args ).exactly(0).times
1186
+ expect( mhosts[2] ).to receive(:external_copy_base).with( no_args ).exactly(0).times
1187
+ expect( mhosts[3] ).to receive(:external_copy_base).with( no_args ).exactly(0).times
1188
+
1189
+ result = object_double(Beaker::Result.new({}, "foo"), :raw_output=> "xyz")
1190
+ allow(subject).to receive(:on).with(mhosts[1], anything).and_return(result)
1191
+
1192
+ expect( subject ).to receive(:configure_type_defaults_on).with( any_args ).exactly(mhosts.length).times
1193
+
1194
+ subject.install_puppet_agent_dev_repo_on( mhosts, opts.merge({:puppet_agent_version => '1.0.0', :copy_dir_external => '/tmp' }) )
1195
+ end
1113
1196
  end
1114
1197
 
1115
1198
  describe '#install_puppet_agent_pe_promoted_repo_on' do
@@ -602,7 +602,7 @@ module Beaker
602
602
 
603
603
  context 'for each host' do
604
604
  it 'calls exec' do
605
- @hosts.each do |host|
605
+ @hosts.each do |host|
606
606
  expect(host).to receive(:exec).once unless host['platform'] =~ /netscaler/
607
607
  end
608
608
  expect(set_hostnames).to eq(@hosts)
@@ -614,6 +614,15 @@ module Beaker
614
614
  end
615
615
  expect(set_hostnames).to eq(@hosts)
616
616
  end
617
+
618
+ it 'sets the the vmhostname to the dns_name for each host' do
619
+ expect(set_hostnames).to eq(@hosts)
620
+ @hosts.each do |host|
621
+ expect(host[:vmhostname]).to eq(host[:dns_name])
622
+ expect(host[:vmhostname]).to eq(host.hostname)
623
+ end
624
+ end
625
+
617
626
  end
618
627
  end
619
628
 
@@ -387,6 +387,17 @@ module Beaker
387
387
  expect { docker.send(:dockerfile_for, {'platform' => 'centos-7-x86_64'})}.to raise_error(/Docker image undefined/)
388
388
  end
389
389
 
390
+ it 'should set "ENV container docker"' do
391
+ FakeFS.deactivate!
392
+ platforms.each do |platform|
393
+ dockerfile = docker.send(:dockerfile_for, {
394
+ 'platform' => platform,
395
+ 'image' => 'foobar',
396
+ })
397
+ expect( dockerfile ).to be =~ /ENV container docker/
398
+ end
399
+ end
400
+
390
401
  it 'should add docker_image_commands as RUN statements' do
391
402
  FakeFS.deactivate!
392
403
  platforms.each do |platform|
@@ -28,6 +28,7 @@ module Beaker
28
28
  expect(options['openstack_tenant']).to eq('testing')
29
29
  expect(options['openstack_network']).to eq('testing')
30
30
  expect(options['openstack_keyname']).to eq('nopass')
31
+ expect(options['security_group']).to eq(['my_sg', 'default'])
31
32
  end
32
33
 
33
34
  it 'check hosts options during initialization' do
@@ -53,6 +54,7 @@ module Beaker
53
54
 
54
55
  mock_servers = double().as_null_object
55
56
  allow( @compute_client ).to receive( :servers ).and_return( mock_servers )
57
+
56
58
  expect(mock_servers).to receive(:create).with(hash_including(
57
59
  :user_data => '#cloud-config\nmanage_etc_hosts: true\nfinal_message: "The host is finally up!"',
58
60
  :flavor_ref => 12345,
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+
3
+ describe Beaker::VagrantCustom do
4
+ let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
5
+ let( :vagrant ) { Beaker::VagrantCustom.new( @hosts, options ) }
6
+
7
+ let(:test_dir) { 'tmp/tests' }
8
+ let(:custom_vagrant_file_path) { File.expand_path(test_dir + '/CustomVagrantfile') }
9
+
10
+ before :each do
11
+ @hosts = make_hosts()
12
+ end
13
+
14
+ it "uses the vagrant_custom provider for provisioning" do
15
+ @hosts.each do |host|
16
+ host_prev_name = host['user']
17
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
18
+ expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
19
+ expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
20
+ end
21
+ expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
22
+ FakeFS.activate!
23
+ expect( vagrant ).to receive( :vagrant_cmd ).with( "up" ).once
24
+ vagrant.provision
25
+ end
26
+
27
+ context 'takes vagrant configuration from existing file' do
28
+ it 'writes the vagrant file to the correct location' do
29
+ options.merge!({ :vagrantfile_path => custom_vagrant_file_path })
30
+
31
+ create_files([custom_vagrant_file_path])
32
+
33
+ vagrant_file_contents = <<-EOF
34
+ FOO
35
+ EOF
36
+ File.open(custom_vagrant_file_path, 'w') { |file| file.write(vagrant_file_contents) }
37
+
38
+ vagrant_copy_location = "#{test_dir}/NewVagrantLocation"
39
+ vagrant.instance_variable_set(:@vagrant_file, vagrant_copy_location)
40
+ vagrant.make_vfile(@hosts, options)
41
+ vagrant_copy_file = File.open(vagrant_copy_location, 'r')
42
+ expect(vagrant_copy_file.read).to be === vagrant_file_contents
43
+ end
44
+
45
+ end
46
+ end
@@ -69,7 +69,8 @@ module HostHelpers
69
69
  :openstack_auth_url => "http://openstack_hypervisor.labs.net:5000/v2.0/tokens",
70
70
  :openstack_tenant => "testing",
71
71
  :openstack_network => "testing",
72
- :openstack_keyname => "nopass" } )
72
+ :openstack_keyname => "nopass",
73
+ :security_group => ['my_sg', 'default'] } )
73
74
  end
74
75
 
75
76
  def generate_result (name, opts )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.50.0
4
+ version: 2.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -465,6 +465,7 @@ files:
465
465
  - Gemfile
466
466
  - HISTORY.md
467
467
  - LICENSE
468
+ - MAINTAINERS
468
469
  - MAINTAINERS.md
469
470
  - README.md
470
471
  - Rakefile
@@ -695,6 +696,7 @@ files:
695
696
  - lib/beaker/hypervisor/openstack.rb
696
697
  - lib/beaker/hypervisor/solaris.rb
697
698
  - lib/beaker/hypervisor/vagrant.rb
699
+ - lib/beaker/hypervisor/vagrant_custom.rb
698
700
  - lib/beaker/hypervisor/vagrant_fusion.rb
699
701
  - lib/beaker/hypervisor/vagrant_libvirt.rb
700
702
  - lib/beaker/hypervisor/vagrant_parallels.rb
@@ -784,6 +786,7 @@ files:
784
786
  - spec/beaker/hypervisor/hypervisor_spec.rb.orig
785
787
  - spec/beaker/hypervisor/openstack_spec.rb
786
788
  - spec/beaker/hypervisor/solaris_spec.rb
789
+ - spec/beaker/hypervisor/vagrant_custom_spec.rb
787
790
  - spec/beaker/hypervisor/vagrant_fusion_spec.rb
788
791
  - spec/beaker/hypervisor/vagrant_libvirt_spec.rb
789
792
  - spec/beaker/hypervisor/vagrant_parallels_spec.rb