boxgrinder-build 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +11 -0
- data/Manifest +6 -7
- data/Rakefile +11 -6
- data/bash_completion +37 -0
- data/bin/boxgrinder-build +20 -5
- data/boxgrinder-build.gemspec +4 -4
- data/lib/boxgrinder-build.rb +2 -1
- data/lib/boxgrinder-build/appliance.rb +26 -24
- data/lib/boxgrinder-build/helpers/augeas-helper.rb +1 -1
- data/lib/boxgrinder-build/helpers/ec2-helper.rb +2 -2
- data/lib/boxgrinder-build/helpers/guestfs-helper.rb +1 -1
- data/lib/boxgrinder-build/helpers/s3-helper.rb +2 -2
- data/lib/boxgrinder-build/managers/plugin-manager.rb +1 -1
- data/lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb +1 -1
- data/lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb +2 -2
- data/lib/boxgrinder-build/plugins/delivery/openstack/openstack-plugin.rb +3 -3
- data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +16 -10
- data/lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb +1 -1
- data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +1 -1
- data/lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb +1 -1
- data/lib/boxgrinder-build/plugins/os/rpm-based/kickstart.rb +5 -1
- data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb +8 -3
- data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-dependency-validator.rb +1 -1
- data/lib/boxgrinder-build/plugins/os/sl/sl-plugin.rb +1 -1
- data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +1 -1
- data/lib/boxgrinder-build/util/concurrent/get_set.rb +46 -0
- data/lib/boxgrinder-build/util/permissions/fs-monitor.rb +182 -0
- data/lib/boxgrinder-build/util/permissions/fs-observer.rb +82 -0
- data/lib/boxgrinder-build/util/permissions/user-switcher.rb +42 -0
- data/rubygem-boxgrinder-build.spec +25 -3
- data/spec/appliance-spec.rb +69 -82
- data/spec/helpers/augeas-helper-spec.rb +0 -2
- data/spec/helpers/guestfs-helper-spec.rb +1 -3
- data/spec/helpers/image-helper-spec.rb +0 -2
- data/spec/helpers/linux-helper-spec.rb +0 -2
- data/spec/helpers/package-helper-spec.rb +0 -2
- data/spec/helpers/plugin-helper-spec.rb +0 -2
- data/spec/helpers/s3-helper-spec.rb +0 -2
- data/spec/managers/plugin-manager-spec.rb +0 -2
- data/spec/plugins/base-plugin-spec.rb +0 -2
- data/spec/plugins/delivery/ebs/ebs-plugin-spec.rb +0 -2
- data/spec/plugins/delivery/elastichosts/elastichosts-plugin-spec.rb +3 -5
- data/spec/plugins/delivery/libvirt/libvirt-plugin-spec.rb +19 -17
- data/spec/plugins/delivery/local/local-plugin-spec.rb +0 -2
- data/spec/plugins/delivery/s3/s3-plugin-spec.rb +6 -8
- data/spec/plugins/delivery/sftp/sftp-plugin-spec.rb +0 -2
- data/spec/plugins/os/centos/centos-plugin-spec.rb +0 -2
- data/spec/plugins/os/fedora/fedora-plugin-spec.rb +0 -2
- data/spec/plugins/os/rhel/rhel-plugin-spec.rb +0 -2
- data/spec/plugins/os/rpm-based/kickstart-spec.rb +0 -2
- data/spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb +16 -4
- data/spec/plugins/os/rpm-based/rpm-dependency-validator-spec.rb +0 -2
- data/spec/plugins/platform/ec2/ec2-plugin-spec.rb +0 -2
- data/spec/plugins/platform/virtualbox/virtualbox-plugin-spec.rb +1 -3
- data/spec/plugins/platform/virtualpc/virtualpc-plugin-spec.rb +0 -1
- data/spec/plugins/platform/vmware/vmware-plugin-spec.rb +25 -24
- data/spec/rcov_helper.rb +2 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/util/concurrent/get-set-spec.rb +43 -0
- data/spec/util/permissions/fs-monitor-spec.rb +233 -0
- data/spec/util/permissions/fs-observer-spec.rb +141 -0
- data/spec/util/permissions/user-switcher-spec.rb +69 -0
- metadata +20 -5
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Summary: A tool for creating appliances from simple plain text files
|
7
7
|
Name: rubygem-%{gemname}
|
8
|
-
Version: 0.10.
|
8
|
+
Version: 0.10.1
|
9
9
|
Release: 1%{?dist}
|
10
10
|
Group: Development/Languages
|
11
11
|
License: LGPLv3+
|
@@ -13,14 +13,14 @@ URL: http://boxgrinder.org/
|
|
13
13
|
Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
|
14
14
|
|
15
15
|
Requires: ruby(abi) = %{rubyabi}
|
16
|
-
Requires: rubygem(boxgrinder-core) >= 0.3.
|
16
|
+
Requires: rubygem(boxgrinder-core) >= 0.3.11
|
17
17
|
Requires: rubygem(boxgrinder-core) < 0.4.0
|
18
18
|
Requires: ruby-libguestfs
|
19
19
|
|
20
20
|
BuildArch: noarch
|
21
21
|
|
22
22
|
BuildRequires: rubygem(rake)
|
23
|
-
BuildRequires: rubygem(boxgrinder-core) >= 0.3.
|
23
|
+
BuildRequires: rubygem(boxgrinder-core) >= 0.3.11
|
24
24
|
BuildRequires: rubygem(boxgrinder-core) < 0.4.0
|
25
25
|
BuildRequires: rubygem(echoe)
|
26
26
|
BuildRequires: ruby-libguestfs
|
@@ -110,6 +110,9 @@ find %{_builddir}%{geminstdir}/bin -type f | xargs chmod a+x
|
|
110
110
|
rm -rf %{_builddir}/%{geminstdir}/integ/packages/*.rpm
|
111
111
|
cp -r %{_builddir}%{gemdir}/* %{buildroot}/%{gemdir}
|
112
112
|
|
113
|
+
install -d -m 755 %{buildroot}/%{_sysconfdir}/bash_completion.d
|
114
|
+
mv %{buildroot}/%{geminstdir}/bash_completion %{buildroot}/%{_sysconfdir}/bash_completion.d/%{name}
|
115
|
+
|
113
116
|
%check
|
114
117
|
pushd %{_builddir}/%{geminstdir}
|
115
118
|
rake spec
|
@@ -118,6 +121,7 @@ popd
|
|
118
121
|
%files
|
119
122
|
%defattr(-, root, root, -)
|
120
123
|
%{_bindir}/boxgrinder-build
|
124
|
+
%{_sysconfdir}/bash_completion.d/%{name}
|
121
125
|
%dir %{geminstdir}
|
122
126
|
%{geminstdir}/bin
|
123
127
|
%{geminstdir}/lib
|
@@ -139,6 +143,24 @@ popd
|
|
139
143
|
%{gemdir}/doc/%{gemname}-%{version}
|
140
144
|
|
141
145
|
%changelog
|
146
|
+
* Wed Feb 29 2012 Marc Savy <msavy@redhat.com> - 0.10.1-1
|
147
|
+
- Upstream release: 0.10.1
|
148
|
+
- [BGBUILD-332] Add support for bash completion
|
149
|
+
- [BGBUILD-338] Weed out non-deterministic tests
|
150
|
+
- [BGBUILD-337] In SL if default repos are disabled, /etc/yum.repos.d folder is not created
|
151
|
+
- [BGBUILD-344] New filesystem monitoring improvements (Fixes: Shifting failed. Permission denied issues)
|
152
|
+
- [BGBUILD-345] Change sudo/chown magic so it only occurs when running without explicit sudo/su (or --change-to-user)
|
153
|
+
- [BGBUILD-346] Confirm Ruby 1.9.3 support
|
154
|
+
- [BGBUILD-348] Simplecov coverage testing for Ruby >=1.9
|
155
|
+
- [BGBUILD-349] Use RbConfig instead of obsolete and deprecated Config deprecation warning with Ruby 1.9.3
|
156
|
+
|
157
|
+
|
158
|
+
* Tue Dec 27 2011 Marek Goldmann <mgoldman@redhat.com> - 0.11.0-1
|
159
|
+
- Upstream release: 0.11.0
|
160
|
+
- [BGBUILD-332] Add support for bash completion
|
161
|
+
- [BGBUILD-338] Weed out non-deterministic tests
|
162
|
+
- [BGBUILD-337] In SL if default repos are disabled, /etc/yum.repos.d folder is not created.
|
163
|
+
|
142
164
|
* Tue Nov 29 2011 Marek Goldmann <mgoldman@redhat.com> - 0.10.0-1
|
143
165
|
- Upstream release: 0.10.0
|
144
166
|
- [BGBUILD-313] boxgrinder build fails to build ec2 image if ec2-user already exists
|
data/spec/appliance-spec.rb
CHANGED
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-build/appliance'
|
22
20
|
require 'ostruct'
|
23
21
|
require 'logger'
|
@@ -26,8 +24,9 @@ module BoxGrinder
|
|
26
24
|
describe Appliance do
|
27
25
|
def prepare_appliance(options = {}, definition_file = "#{File.dirname(__FILE__)}/rspec/src/appliances/jeos-f13.appl")
|
28
26
|
@log = LogHelper.new(:level => :trace, :type => :stdout)
|
29
|
-
@config = OpenCascade.new(:platform => :none, :delivery => :none, :force => false,
|
30
|
-
|
27
|
+
@config = OpenCascade.new(:platform => :none, :delivery => :none, :force => false,
|
28
|
+
:change_to_user => false, :uid => 501, :gid => 501,
|
29
|
+
:dir => {:root => '/', :build => 'build'}).merge(options)
|
31
30
|
|
32
31
|
@plugin_manager = mock(PluginManager)
|
33
32
|
|
@@ -174,6 +173,13 @@ module BoxGrinder
|
|
174
173
|
before(:each) do
|
175
174
|
prepare_appliance
|
176
175
|
@appliance.instance_variable_set(:@appliance_config, prepare_appliance_config)
|
176
|
+
|
177
|
+
UserSwitcher.stub(:change_user)
|
178
|
+
|
179
|
+
@plugin1, @plugin2, @plugin3 = 3.times.map{|i| mock(i).as_null_object}
|
180
|
+
|
181
|
+
@p_chain = [{:plugin => @plugin1, :param => 'definition'},
|
182
|
+
{:plugin => @plugin2}, {:plugin => @plugin3}]
|
177
183
|
end
|
178
184
|
|
179
185
|
it "should not fail when plugin chain is empty" do
|
@@ -182,30 +188,67 @@ module BoxGrinder
|
|
182
188
|
end
|
183
189
|
|
184
190
|
it "should execute the whole plugin chain" do
|
185
|
-
@appliance.instance_variable_set(:@plugin_chain,
|
191
|
+
@appliance.instance_variable_set(:@plugin_chain, @p_chain)
|
192
|
+
|
193
|
+
@appliance.should_receive(:execute_plugin).with(@plugin1, 'definition')
|
194
|
+
@appliance.should_receive(:execute_plugin).with(@plugin2, nil)
|
195
|
+
@appliance.should_receive(:execute_plugin).with(@plugin3, nil)
|
196
|
+
|
197
|
+
@appliance.execute_plugin_chain
|
198
|
+
end
|
186
199
|
|
187
|
-
|
188
|
-
|
189
|
-
|
200
|
+
context "when executing without change_user" do
|
201
|
+
before(:each) do
|
202
|
+
@config.stub(:change_to_user).and_return(false) # default
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should not switch users" do
|
206
|
+
@appliance.instance_variable_set(:@plugin_chain, [])
|
207
|
+
|
208
|
+
UserSwitcher.should_not_receive(:change_user)
|
209
|
+
@appliance.execute_plugin_chain
|
210
|
+
end
|
211
|
+
end
|
190
212
|
|
191
|
-
|
213
|
+
context "when executing with change_user" do
|
214
|
+
before(:each) do
|
215
|
+
@config.stub(:change_to_user).and_return(true)
|
216
|
+
@plugin1.stub_chain(:plugin_info, :[]).and_return(true)
|
217
|
+
@plugin2.stub_chain(:plugin_info, :[]).and_return(false)
|
218
|
+
@plugin3.stub_chain(:plugin_info, :[]).and_return(false)
|
219
|
+
|
220
|
+
@appliance.instance_variable_set(:@plugin_chain, @p_chain)
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should switch users if the plugin requires root, but not for those that do not" do
|
224
|
+
UserSwitcher.should_receive(:change_user).with(0, 0)
|
225
|
+
UserSwitcher.should_receive(:change_user).twice.with(501, 501)
|
226
|
+
|
227
|
+
@appliance.execute_plugin_chain
|
228
|
+
end
|
192
229
|
end
|
193
230
|
end
|
194
231
|
|
195
232
|
describe ".initialize_plugins" do
|
233
|
+
let(:os_plugin){ mock("OSPlugin") }
|
234
|
+
|
235
|
+
let(:os_plugin_info_mock){ mock('os_plugin_info_mock', :[] => 'os').as_null_object }
|
236
|
+
let(:platform_plugin_info_mock){ mock('platform_plugin_info_mock', :[] => 'plat').as_null_object }
|
237
|
+
let(:delivery_plugin_info_mock){ mock('delivery_plugin_info_mock', :[] => 'deliver').as_null_object }
|
238
|
+
|
239
|
+
let(:platform_plugin){ mock("PlatformPlugin", :deliverables => OpenCascade.new(:disk => 'a/disk.vmdk')) }
|
240
|
+
let(:delivery_plugin){ mock("DeliveryPlugin", :deliverables => {}) }
|
241
|
+
|
196
242
|
it "should prepare the plugin chain to create an appliance and convert it to VMware format" do
|
197
243
|
prepare_appliance(:platform => :vmware)
|
198
244
|
@appliance.instance_variable_set(:@appliance_config, prepare_appliance_config)
|
199
245
|
|
200
|
-
os_plugin
|
201
|
-
|
202
|
-
|
203
|
-
@plugin_manager.should_receive(:initialize_plugin).with(:os, :fedora).and_return([os_plugin, "os_plugin_info"])
|
204
|
-
@plugin_manager.should_receive(:initialize_plugin).with(:platform, :vmware).and_return([platform_plugin, "platform_plugin_info"])
|
246
|
+
@plugin_manager.should_receive(:initialize_plugin).with(:os, :fedora).and_return([os_plugin, os_plugin_info_mock])
|
247
|
+
@plugin_manager.should_receive(:initialize_plugin).with(:platform, :vmware).and_return([platform_plugin, platform_plugin_info_mock])
|
205
248
|
@plugin_manager.should_not_receive(:initialize_plugin).with(:delivery, anything)
|
206
249
|
|
207
|
-
os_plugin.should_receive(:init).with(@config, @appliance_config,
|
208
|
-
platform_plugin.should_receive(:init).with(@config, @appliance_config,
|
250
|
+
os_plugin.should_receive(:init).with(@config, @appliance_config, os_plugin_info_mock, :log => @log)
|
251
|
+
platform_plugin.should_receive(:init).with(@config, @appliance_config, platform_plugin_info_mock, :log => @log, :previous_plugin => os_plugin)
|
209
252
|
|
210
253
|
@appliance.initialize_plugins
|
211
254
|
|
@@ -217,17 +260,13 @@ module BoxGrinder
|
|
217
260
|
prepare_appliance(:platform => :vmware, :delivery => :s3)
|
218
261
|
@appliance.instance_variable_set(:@appliance_config, prepare_appliance_config)
|
219
262
|
|
220
|
-
os_plugin
|
221
|
-
platform_plugin
|
222
|
-
|
263
|
+
@plugin_manager.should_receive(:initialize_plugin).with(:os, :fedora).and_return([os_plugin, os_plugin_info_mock])
|
264
|
+
@plugin_manager.should_receive(:initialize_plugin).with(:platform, :vmware).and_return([platform_plugin, platform_plugin_info_mock])
|
265
|
+
@plugin_manager.should_receive(:initialize_plugin).with(:delivery, :s3).and_return([delivery_plugin, delivery_plugin_info_mock])
|
223
266
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
os_plugin.should_receive(:init).with(@config, @appliance_config, "os_plugin_info", :log => @log)
|
229
|
-
platform_plugin.should_receive(:init).with(@config, @appliance_config, "platform_plugin_info", :log => @log, :previous_plugin => os_plugin)
|
230
|
-
delivery_plugin.should_receive(:init).with(@config, @appliance_config, "delivery_plugin_info", :log => @log, :previous_plugin => platform_plugin, :type => :s3)
|
267
|
+
os_plugin.should_receive(:init).with(@config, @appliance_config, os_plugin_info_mock, :log => @log)
|
268
|
+
platform_plugin.should_receive(:init).with(@config, @appliance_config, platform_plugin_info_mock, :log => @log, :previous_plugin => os_plugin)
|
269
|
+
delivery_plugin.should_receive(:init).with(@config, @appliance_config, delivery_plugin_info_mock, :log => @log, :previous_plugin => platform_plugin, :type => :s3)
|
231
270
|
|
232
271
|
@appliance.initialize_plugins
|
233
272
|
|
@@ -239,15 +278,12 @@ module BoxGrinder
|
|
239
278
|
prepare_appliance(:delivery => :s3)
|
240
279
|
@appliance.instance_variable_set(:@appliance_config, prepare_appliance_config)
|
241
280
|
|
242
|
-
os_plugin
|
243
|
-
delivery_plugin
|
244
|
-
|
245
|
-
@plugin_manager.should_receive(:initialize_plugin).with(:os, :fedora).and_return([os_plugin, "os_plugin_info"])
|
246
|
-
@plugin_manager.should_receive(:initialize_plugin).with(:delivery, :s3).and_return([delivery_plugin, "delivery_plugin_info"])
|
281
|
+
@plugin_manager.should_receive(:initialize_plugin).with(:os, :fedora).and_return([os_plugin, os_plugin_info_mock])
|
282
|
+
@plugin_manager.should_receive(:initialize_plugin).with(:delivery, :s3).and_return([delivery_plugin, delivery_plugin_info_mock])
|
247
283
|
@plugin_manager.should_not_receive(:initialize_plugin).with(:platform, anything)
|
248
284
|
|
249
|
-
os_plugin.should_receive(:init).with(@config, @appliance_config,
|
250
|
-
delivery_plugin.should_receive(:init).with(@config, @appliance_config,
|
285
|
+
os_plugin.should_receive(:init).with(@config, @appliance_config, os_plugin_info_mock, :log => @log)
|
286
|
+
delivery_plugin.should_receive(:init).with(@config, @appliance_config, delivery_plugin_info_mock, :log => @log, :previous_plugin => os_plugin, :type => :s3)
|
251
287
|
|
252
288
|
@appliance.initialize_plugins
|
253
289
|
end
|
@@ -271,30 +307,6 @@ module BoxGrinder
|
|
271
307
|
|
272
308
|
@appliance.execute_plugin(plugin, :s3)
|
273
309
|
end
|
274
|
-
|
275
|
-
context "user switching" do
|
276
|
-
before(:each) do
|
277
|
-
FileUtils.stub!(:chown_R)
|
278
|
-
@appliance.stub!(:change_user)
|
279
|
-
end
|
280
|
-
|
281
|
-
it "should switch to user from root after execution of OS plugin" do
|
282
|
-
plugin = mock('OSPlugin', :deliverables_exists? => false, :plugin_info => {:name => :test, :type => :os})
|
283
|
-
FileUtils.should_receive(:chown_R).with(501, 501, '/build')
|
284
|
-
@appliance.should_receive(:change_user).with(501, 501)
|
285
|
-
plugin.should_receive(:run).with(:test)
|
286
|
-
|
287
|
-
@appliance.execute_plugin(plugin, :test)
|
288
|
-
end
|
289
|
-
|
290
|
-
it "should switch to user from root after OS plugin even if deliverables exist" do
|
291
|
-
plugin = mock('OSPlugin', :deliverables_exists? => true, :plugin_info => {:name => :test, :type => :os})
|
292
|
-
FileUtils.should_receive(:chown_R).with(501, 501, '/build')
|
293
|
-
@appliance.should_receive(:change_user).with(501, 501)
|
294
|
-
|
295
|
-
@appliance.execute_plugin(plugin, :test)
|
296
|
-
end
|
297
|
-
end
|
298
310
|
end
|
299
311
|
|
300
312
|
context "preparations" do
|
@@ -318,30 +330,5 @@ module BoxGrinder
|
|
318
330
|
@appliance.delivery_selected?.should == false
|
319
331
|
end
|
320
332
|
end
|
321
|
-
|
322
|
-
context ".change_user" do
|
323
|
-
before(:each) do
|
324
|
-
prepare_appliance
|
325
|
-
end
|
326
|
-
context "Interpreters supporting changes to real, effective and saved ids" do
|
327
|
-
it "should change the real, effective and saved uid & gid" do
|
328
|
-
Process::Sys.should_receive(:respond_to?).twice.and_return(true)
|
329
|
-
Process::Sys.should_receive(:setresuid).with(501, 501, 501)
|
330
|
-
Process::Sys.should_receive(:setresgid).with(502, 502, 502)
|
331
|
-
@appliance.change_user(501, 502)
|
332
|
-
end
|
333
|
-
end
|
334
|
-
context "Interpreters only supporting changes to real and effective ids" do
|
335
|
-
it "should change the real and effective uid & gid" do
|
336
|
-
Process::Sys.should_receive(:respond_to?).once.and_return(false)
|
337
|
-
Process.should_receive(:gid=).with(502)
|
338
|
-
Process.should_receive(:egid=).with(502)
|
339
|
-
Process.should_receive(:uid=).with(501)
|
340
|
-
Process.should_receive(:euid=).with(501)
|
341
|
-
@appliance.change_user(501, 502)
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
333
|
end
|
347
334
|
end
|
@@ -17,8 +17,6 @@
|
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
19
|
require 'boxgrinder-build/helpers/guestfs-helper'
|
20
|
-
require 'rubygems'
|
21
|
-
require 'rspec'
|
22
20
|
require 'hashery/opencascade'
|
23
21
|
|
24
22
|
module BoxGrinder
|
@@ -56,7 +54,7 @@ module BoxGrinder
|
|
56
54
|
end
|
57
55
|
end
|
58
56
|
|
59
|
-
it "should prepare and run guestfs
|
57
|
+
it "should prepare and run guestfs with IDE disk" do
|
60
58
|
guestfs = mock('Guestfs')
|
61
59
|
@helper.instance_variable_set(:@guestfs, guestfs)
|
62
60
|
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-core/helpers/log-helper'
|
22
20
|
require 'boxgrinder-build/helpers/plugin-helper'
|
23
21
|
require 'ostruct'
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-build/plugins/base-plugin'
|
22
20
|
require 'boxgrinder-core/helpers/log-helper'
|
23
21
|
require 'yaml'
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'hashery/opencascade'
|
22
20
|
require 'boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin'
|
23
21
|
|
@@ -236,7 +234,7 @@ module BoxGrinder
|
|
236
234
|
@plugin.upload_chunk("data", 1)
|
237
235
|
end
|
238
236
|
|
239
|
-
it "should upload a chunk of data and be
|
237
|
+
it "should upload a chunk of data and be successful after 1 retry" do
|
240
238
|
@plugin.should_receive(:api_url).with('/drives/drive-uuid/write/0').and_return('url')
|
241
239
|
RestClient.should_receive(:post).with('url', 'data', :content_type=>"application/octet-stream", "Content-Encoding"=>"gzip").and_raise('boom')
|
242
240
|
@plugin.should_receive(:sleep).with(5)
|
@@ -267,7 +265,7 @@ module BoxGrinder
|
|
267
265
|
}.should raise_error(PluginError, "Couldn't upload appliance, boom.")
|
268
266
|
end
|
269
267
|
|
270
|
-
it "should not specify add content-encoding header if
|
268
|
+
it "should not specify add content-encoding header if uploading to cloudsigma" do
|
271
269
|
@plugin_config.merge!('endpoint' => 'api.cloudsigma.com')
|
272
270
|
|
273
271
|
@plugin.should_receive(:api_url).with('/drives/drive-uuid/write/0').and_return('url')
|
@@ -329,7 +327,7 @@ module BoxGrinder
|
|
329
327
|
|
330
328
|
lambda {
|
331
329
|
@plugin.create_server
|
332
|
-
}.should raise_error(PluginError, 'An error
|
330
|
+
}.should raise_error(PluginError, 'An error occurred while creating the server, boom. See logs for more info.')
|
333
331
|
end
|
334
332
|
end
|
335
333
|
|
@@ -279,22 +279,24 @@ module BoxGrinder
|
|
279
279
|
|
280
280
|
# Fuller combinatorial coverage in cucumber required
|
281
281
|
describe ".build_xml" do
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
282
|
+
# These sometimes fail due to ordering of XML elements, after adding xml
|
283
|
+
# equivalence operators it should be much simpler.
|
284
|
+
# it "should build an xml definition from appliance config & user options" do
|
285
|
+
# prepare_plugin do |p, c|
|
286
|
+
# end
|
287
|
+
|
288
|
+
# @plugin.build_xml(:bus => 'bus', :os_type => :box, :domain_type => :grinder).
|
289
|
+
# should == open("#{File.dirname(__FILE__)}/libvirt_test.xml").read
|
290
|
+
# end
|
291
|
+
|
292
|
+
# it "should allow modification of the xml definition via script" do
|
293
|
+
# prepare_plugin do |p, c|
|
294
|
+
# c['script'] = "#{File.dirname(__FILE__)}/libvirt_modify.sh"
|
295
|
+
# end
|
296
|
+
|
297
|
+
# @plugin.build_xml(:bus => 'bus', :os_type => :box, :domain_type => :grinder).
|
298
|
+
# should == open("#{File.dirname(__FILE__)}/libvirt_modified.xml").read
|
299
|
+
# end
|
298
300
|
end
|
299
301
|
end
|
300
|
-
end
|
302
|
+
end
|