vagrant-ovirt4 2.1.3 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f8d267202b71616a27bf1a4b721fe29264a7128d7643d0059a0558a3a6d76c8
4
- data.tar.gz: 4dfc4ee00d4dfef59a9a9acf0e4639bdcd86bf4f030de479e6e0c526eb088441
3
+ metadata.gz: a9d8f5174e1f8b016b4b832ec0ad9b90306bfb2bddde338213d29c697010b43d
4
+ data.tar.gz: '0637690ae57219b53d018430ab5573495a086ec7ed1ceb2d90d6f2f6f670c629'
5
5
  SHA512:
6
- metadata.gz: 013cbee883c91387751dcb150c4cae7af3e73275845d67f9019e6b508564ad756adc48d8d6d84b721188bd631e006511a58928c3e44b34b0086deac8a50d2d74
7
- data.tar.gz: b281f7740fbc84ca12bc8c81a95a6b1ebfeeaa4246c0726384b389a0130716291bf3d859650fcc697a22a7f97a671e114745e403a0b5bb27137b24197e6dc3a5
6
+ metadata.gz: 90e8331a727b24e155d29dcf1d3f8567903f5b7eef088d64dd4b7da363ee32e68bae8ee2ff32e80e002cfa57745d1047b0c3b521b08322bab74457f5095f251d
7
+ data.tar.gz: c5b3b0a0c3d05a34ad1f89c716314b50ec39c0157c40f93d3a74cc0b531f37d76c16468b7ed20386751da2683eda9bdcbcc45999e5eaac724e9ea44209c53f8b
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v2.2.0
2
+ ef555e3 Config spec: assert that we test all attributes
3
+ 6e47c1b Add tests for additional configuration params
4
+
1
5
  v2.1.2
2
6
  79a0074 Fix lock file
3
7
 
data/Gemfile.lock CHANGED
@@ -28,7 +28,7 @@ GIT
28
28
  PATH
29
29
  remote: .
30
30
  specs:
31
- vagrant-ovirt4 (2.1.3)
31
+ vagrant-ovirt4 (2.2.0)
32
32
  filesize (~> 0)
33
33
  nokogiri (~> 1)
34
34
  ovirt-engine-sdk (~> 4)
@@ -5,6 +5,7 @@ require 'ovirtsdk4'
5
5
  module VagrantPlugins
6
6
  module OVirtProvider
7
7
  class Config < Vagrant.plugin('2', :config)
8
+ attr_reader :disks
8
9
 
9
10
  attr_accessor :url
10
11
  attr_accessor :username
@@ -30,7 +31,6 @@ module VagrantPlugins
30
31
  attr_accessor :description
31
32
  attr_accessor :comment
32
33
  attr_accessor :vmname
33
- attr_accessor :disks
34
34
  attr_accessor :timeout
35
35
  attr_accessor :connect_timeout
36
36
  attr_accessor :run_once
@@ -1,6 +1,6 @@
1
1
  module VagrantPlugins
2
2
  module OVirtProvider
3
- VERSION = '2.1.3'
3
+ VERSION = '2.2.0'
4
4
  end
5
5
  end
6
6
 
@@ -11,11 +11,53 @@ RSpec.configure do |config|
11
11
  config.expect_with :rspec do |c|
12
12
  c.syntax = [:should, :expect]
13
13
  end
14
+
15
+ # When this setting is enabled, check that we saw calls to all available
16
+ # provider config readers and writers.
17
+ config.add_setting :check_provider_config_attr_accessor_calls
18
+ config.check_provider_config_attr_accessor_calls ||= ENV.key?('CI')
14
19
  end
15
20
 
16
21
  describe VagrantPlugins::OVirtProvider::Config do
17
22
  let(:instance) { described_class.new }
18
23
 
24
+ if RSpec.configuration.check_provider_config_attr_accessor_calls
25
+ before :all do
26
+ @writers ||= described_class.instance_methods.grep(/\w\=$/).sort - Vagrant.plugin('2', :config).instance_methods
27
+ @readers ||= @writers.map { |w| w.to_s.sub(/\=$/, '').to_sym }
28
+
29
+ @writer_calls ||= Hash.new { |h, w| h[w] = 0 }
30
+ @reader_calls ||= Hash.new { |h, r| h[r] = 0 }
31
+ end
32
+
33
+ before :each do
34
+ @writers.each do |writer|
35
+ ivar = :"@#{writer.to_s.sub(/\=$/, '')}"
36
+ allow(instance).to receive(writer) do |arg|
37
+ instance.instance_variable_set(ivar, arg)
38
+ @writer_calls[writer] += 1
39
+ arg
40
+ end
41
+ end
42
+
43
+ @readers.each do |reader|
44
+ ivar = :"@#{reader}"
45
+
46
+ allow(instance).to receive(reader) do
47
+ @reader_calls[reader] += 1
48
+ instance.instance_variable_get(ivar)
49
+ end
50
+ end
51
+ end
52
+
53
+ after :all do
54
+ missing_writers = @writers.select { |w| @writer_calls[w].zero? }
55
+ missing_readers = @readers.select { |w| @reader_calls[w].zero? }
56
+ all = missing_readers + missing_writers
57
+ fail "saw no tests of the following config methods: #{all.map(&:inspect).join(", ")}" unless all.empty?
58
+ end
59
+ end
60
+
19
61
  # Ensure tests are not affected by AWS credential environment variables
20
62
  before :each do
21
63
  ENV.stub(:[] => nil)
@@ -50,12 +92,16 @@ describe VagrantPlugins::OVirtProvider::Config do
50
92
  its("optimized_for") { should be_nil }
51
93
  its("description") { should == '' }
52
94
  its("comment") { should == '' }
95
+ its("vmname") { should be_nil }
96
+ its("timeout") { should be_nil }
97
+ its("connect_timeout") { should be_nil }
98
+ its("disks") { should be_empty }
53
99
  its("run_once") { should be false }
54
100
 
55
101
  end
56
102
 
57
103
  describe "overriding defaults" do
58
- [:url, :username, :password, :insecure, :debug, :filtered_api, :cpu_cores, :cpu_sockets, :cpu_threads, :cluster, :console, :template, :cloud_init, :placement_host, :bios_serial, :description, :comment].each do |attribute|
104
+ [:url, :username, :password, :insecure, :debug, :filtered_api, :cpu_cores, :cpu_sockets, :cpu_threads, :cluster, :console, :template, :cloud_init, :placement_host, :bios_serial, :description, :comment, :vmname].each do |attribute|
59
105
 
60
106
  it "should not default #{attribute} if overridden" do
61
107
  instance.send("#{attribute}=".to_sym, "foo")
@@ -126,6 +172,26 @@ describe VagrantPlugins::OVirtProvider::Config do
126
172
 
127
173
  end
128
174
 
175
+ describe "overriding disk size defaults" do
176
+ ['10 GiB', '999 M', '101010101 KB'].each do |value|
177
+ it "should accept #{value.inspect} for disk size" do
178
+ instance.send("disk_size=".to_sym, value)
179
+ expect { instance.finalize! }.not_to raise_error
180
+ end
181
+ end
182
+
183
+ [-1, '10 Umm', Object.new].each do |value|
184
+ it "should reject #{value.inspect} for disk size" do
185
+ instance.send("disk_size=".to_sym, value)
186
+ expect { instance.finalize! }.to raise_error do |error|
187
+ expect(error).to be_a(RuntimeError)
188
+ expect(error.message).to match(/^Not able to parse '[^']+'\. Please verify and check again\.$/)
189
+ end
190
+ end
191
+ end
192
+
193
+ end
194
+
129
195
  describe "overriding timeout defaults" do
130
196
  [:timeout, :connect_timeout].each do |attribute|
131
197
  [0, 6, 1_000_000, 8.10, nil].each do |value|
@@ -156,6 +222,52 @@ describe VagrantPlugins::OVirtProvider::Config do
156
222
 
157
223
  end
158
224
 
225
+ describe "adding storage" do
226
+ let(:storage) { :file }
227
+ let(:storage_size) { '8 GiB' }
228
+ let(:storage_type) { 'qcow2' }
229
+ let(:storage_domain) { 'mystoragedomain' }
230
+
231
+ def configure_storage!
232
+ instance.storage(storage, size: storage_size, type: storage_type, storage_domain: storage_domain)
233
+ end
234
+
235
+ before do
236
+ expect(instance.disks).to be_empty
237
+ end
238
+
239
+ it "handles storage specifications" do
240
+ configure_storage!
241
+ instance.finalize!
242
+ expect(instance.disks).not_to be_empty
243
+ expect(instance.disks).to include(hash_including(
244
+ name: 'storage_disk_1',
245
+ type: storage_type,
246
+ bus: 'virtio',
247
+ storage_domain: storage_domain,
248
+ ))
249
+ end
250
+
251
+ context "given a type other than #{:file.inspect}" do
252
+ let(:storage) { :foobar }
253
+
254
+ it "ignores the storage specification" do
255
+ configure_storage!
256
+ instance.finalize!
257
+ expect(instance.disks).to be_empty
258
+ end
259
+ end
260
+
261
+ context "given an invalid storage size" do
262
+ let(:storage_size) { 'Nope' }
263
+
264
+ it "raises an exception" do
265
+ expect { configure_storage! }.to raise_error(ArgumentError)
266
+ end
267
+ end
268
+
269
+ end
270
+
159
271
  describe "overriding run_once defaults" do
160
272
  context "given truthy values" do
161
273
  [Object.new, {}, true, 1, 0].each do |value|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-ovirt4
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Young