vagrant-ovirt4 2.1.3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/Gemfile.lock +1 -1
- data/lib/vagrant-ovirt4/config.rb +1 -1
- data/lib/vagrant-ovirt4/version.rb +1 -1
- data/spec/vagrant-ovirt4/config_spec.rb +113 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9d8f5174e1f8b016b4b832ec0ad9b90306bfb2bddde338213d29c697010b43d
|
4
|
+
data.tar.gz: '0637690ae57219b53d018430ab5573495a086ec7ed1ceb2d90d6f2f6f670c629'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90e8331a727b24e155d29dcf1d3f8567903f5b7eef088d64dd4b7da363ee32e68bae8ee2ff32e80e002cfa57745d1047b0c3b521b08322bab74457f5095f251d
|
7
|
+
data.tar.gz: c5b3b0a0c3d05a34ad1f89c716314b50ec39c0157c40f93d3a74cc0b531f37d76c16468b7ed20386751da2683eda9bdcbcc45999e5eaac724e9ea44209c53f8b
|
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
@@ -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|
|