beaker-vmware 0.3.0 → 2.0.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 +5 -5
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/release.yml +32 -0
- data/.github/workflows/test.yml +56 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +266 -0
- data/.simplecov +1 -1
- data/CHANGELOG.md +62 -0
- data/Gemfile +6 -21
- data/README.md +43 -9
- data/Rakefile +34 -119
- data/beaker-vmware.gemspec +20 -30
- data/bin/beaker-vmware +1 -3
- data/lib/beaker/hypervisor/fusion.rb +21 -23
- data/lib/beaker/hypervisor/vsphere.rb +23 -24
- data/lib/beaker/hypervisor/vsphere_helper.rb +78 -81
- data/lib/beaker-vmware/version.rb +1 -1
- data/spec/beaker/hypervisor/fusion_spec.rb +14 -16
- data/spec/beaker/hypervisor/vsphere_helper_spec.rb +120 -124
- data/spec/beaker/hypervisor/vsphere_spec.rb +28 -40
- data/spec/mock_fission.rb +63 -0
- data/spec/mock_vsphere.rb +284 -0
- data/spec/mock_vsphere_helper.rb +167 -0
- data/spec/spec_helper.rb +28 -3
- metadata +65 -59
@@ -2,89 +2,77 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Beaker
|
4
4
|
describe Vsphere do
|
5
|
-
|
6
|
-
|
7
|
-
MockVsphereHelper.
|
8
|
-
|
9
|
-
stub_const( "VsphereHelper", MockVsphereHelper )
|
5
|
+
before do
|
6
|
+
MockVsphereHelper.set_config(fog_file_contents)
|
7
|
+
MockVsphereHelper.set_vms(make_hosts)
|
8
|
+
stub_const('VsphereHelper', MockVsphereHelper)
|
10
9
|
end
|
11
10
|
|
12
|
-
describe
|
13
|
-
|
14
|
-
it 'provisions hosts' do
|
11
|
+
describe '#provision' do
|
12
|
+
it 'provisions hosts' do
|
15
13
|
MockVsphereHelper.powerOff
|
16
|
-
vsphere = Beaker::Vsphere.new(
|
14
|
+
vsphere = Beaker::Vsphere.new(make_hosts, make_opts)
|
17
15
|
|
18
16
|
vsphere.provision
|
19
17
|
|
20
|
-
hosts =
|
18
|
+
hosts = vsphere.instance_variable_get(:@hosts)
|
21
19
|
hosts.each do |host|
|
22
|
-
expect(
|
20
|
+
expect(MockVsphereHelper.find_vm(host.name).powerState) == 'poweredOn'
|
23
21
|
end
|
24
|
-
|
25
22
|
end
|
26
23
|
|
27
24
|
it 'raises an error if a vm is missing in Vsphere' do
|
28
25
|
MockVsphereHelper.powerOff
|
29
|
-
hosts = make_hosts
|
26
|
+
hosts = make_hosts
|
30
27
|
hosts[0][:vmname] = 'unknown'
|
31
|
-
vsphere = Beaker::Vsphere.new(
|
32
|
-
|
33
|
-
expect{ vsphere.provision }.to raise_error
|
28
|
+
vsphere = Beaker::Vsphere.new(hosts, make_opts)
|
34
29
|
|
30
|
+
expect { vsphere.provision }.to raise_error
|
35
31
|
end
|
36
32
|
|
37
33
|
it 'raises an error if a vm does not have a given snapshot name' do
|
38
34
|
MockVsphereHelper.powerOff
|
39
|
-
hosts = make_hosts
|
40
|
-
hosts[0][
|
41
|
-
vsphere = Beaker::Vsphere.new(
|
42
|
-
|
43
|
-
expect{ vsphere.provision }.to raise_error
|
35
|
+
hosts = make_hosts
|
36
|
+
hosts[0]['snapshot'] = 'unknown'
|
37
|
+
vsphere = Beaker::Vsphere.new(hosts, make_opts)
|
44
38
|
|
39
|
+
expect { vsphere.provision }.to raise_error
|
45
40
|
end
|
46
41
|
|
47
42
|
it 'provisions hosts if no snapshot is provided' do
|
48
43
|
MockVsphereHelper.powerOff
|
49
|
-
hosts = make_hosts
|
50
|
-
hosts[0][
|
51
|
-
vsphere = Beaker::Vsphere.new(
|
44
|
+
hosts = make_hosts
|
45
|
+
hosts[0]['snapshot'] = nil
|
46
|
+
vsphere = Beaker::Vsphere.new(hosts, make_opts)
|
52
47
|
|
53
48
|
vsphere.provision
|
54
49
|
|
55
50
|
hosts.each do |host|
|
56
|
-
expect(
|
51
|
+
expect(MockVsphereHelper.find_vm(host.name).powerState) == 'poweredOn'
|
57
52
|
end
|
58
|
-
|
59
53
|
end
|
60
|
-
|
61
54
|
end
|
62
55
|
|
63
|
-
describe
|
64
|
-
|
65
|
-
it "cleans up" do
|
56
|
+
describe '#cleanup' do
|
57
|
+
it 'cleans up' do
|
66
58
|
MockVsphereHelper.powerOn
|
67
|
-
vsphere = Beaker::Vsphere.new(
|
59
|
+
vsphere = Beaker::Vsphere.new(make_hosts, make_opts)
|
68
60
|
vsphere.cleanup
|
69
61
|
|
70
|
-
hosts =
|
62
|
+
hosts = vsphere.instance_variable_get(:@hosts)
|
71
63
|
hosts.each do |host|
|
72
|
-
expect(
|
64
|
+
expect(MockVsphereHelper.find_vm(host.name).powerState) == 'poweredOff'
|
73
65
|
end
|
74
66
|
end
|
75
67
|
|
76
68
|
it 'raises an error if a vm is missing in Vsphere' do
|
77
69
|
MockVsphereHelper.powerOn
|
78
|
-
hosts = make_hosts
|
70
|
+
hosts = make_hosts
|
79
71
|
hosts[0][:vmname] = 'unknown'
|
80
|
-
vsphere = Beaker::Vsphere.new(
|
81
|
-
|
82
|
-
expect{ vsphere.cleanup }.to raise_error
|
72
|
+
vsphere = Beaker::Vsphere.new(hosts, make_opts)
|
83
73
|
|
74
|
+
expect { vsphere.cleanup }.to raise_error
|
84
75
|
end
|
85
|
-
|
86
76
|
end
|
87
|
-
|
88
77
|
end
|
89
|
-
|
90
78
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class Response
|
2
|
+
attr_accessor :code, :message, :data
|
3
|
+
|
4
|
+
def initialize(code = 0, message = '', data = nil)
|
5
|
+
@code = code
|
6
|
+
@message = message
|
7
|
+
@data = data
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class MockFissionVM
|
12
|
+
attr_accessor :name
|
13
|
+
|
14
|
+
@@snaps = []
|
15
|
+
def initialize(name)
|
16
|
+
@name = name
|
17
|
+
@running = true
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.set_snapshots(snaps)
|
21
|
+
@@snaps = snaps
|
22
|
+
end
|
23
|
+
|
24
|
+
def snapshots
|
25
|
+
Response.new(0, '', @@snaps)
|
26
|
+
end
|
27
|
+
|
28
|
+
def revert_to_snapshot(_name)
|
29
|
+
@running = false
|
30
|
+
end
|
31
|
+
|
32
|
+
def running?
|
33
|
+
Response.new(0, '', @running)
|
34
|
+
end
|
35
|
+
|
36
|
+
def start(_opt)
|
37
|
+
@running = true
|
38
|
+
end
|
39
|
+
|
40
|
+
def exists?
|
41
|
+
true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class MockFission
|
46
|
+
@@vms = []
|
47
|
+
def self.presets(hosts)
|
48
|
+
snaps = []
|
49
|
+
hosts.each do |host|
|
50
|
+
@@vms << MockFissionVM.new(host.name)
|
51
|
+
snaps << host[:snapshot]
|
52
|
+
end
|
53
|
+
MockFissionVM.set_snapshots(snaps)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.all
|
57
|
+
Response.new(0, '', @@vms)
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.new(name)
|
61
|
+
MockFissionVM.new(name)
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,284 @@
|
|
1
|
+
class MockRbVmomiSnapshot
|
2
|
+
attr_accessor :name, :rootSnapshotList, :childSnapshotList
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@name = nil
|
6
|
+
@rootSnapshotList = []
|
7
|
+
@childSnapshotList = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def print_nested_array(arg)
|
11
|
+
str = '[ '
|
12
|
+
arg.each do |arry|
|
13
|
+
if arry.is_a?(Array)
|
14
|
+
str += print_nested_array(arry)
|
15
|
+
elsif arry.is_a?(MockRbVmomiSnapshot)
|
16
|
+
str += arry.to_s + ', '
|
17
|
+
end
|
18
|
+
end
|
19
|
+
str + ' ]'
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"Snapshot(name: #{@name}, rootSnapshotlist: #{print_nested_array(@rootSnapshotList)}, childSnapshotList: #{print_nested_array(@childSnapshotList)})"
|
24
|
+
end
|
25
|
+
|
26
|
+
def snapshot
|
27
|
+
self
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class MockRbVmomiVM
|
32
|
+
attr_accessor :snapshot, :name, :state
|
33
|
+
|
34
|
+
def info
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
def process_snaphash(snaphash)
|
39
|
+
shotlist = []
|
40
|
+
snaphash.each do |name, subsnaps|
|
41
|
+
new_snap = MockRbVmomiSnapshot.new
|
42
|
+
new_snap.name = name
|
43
|
+
new_snap.childSnapshotList = process_snaphash(subsnaps) if subsnaps.is_a?(Hash)
|
44
|
+
shotlist << new_snap
|
45
|
+
end
|
46
|
+
shotlist
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_snapshot(name, snaplist = @snapshot.rootSnapshotList)
|
50
|
+
snapshot = nil
|
51
|
+
snaplist.each do |snap|
|
52
|
+
if snap.is_a?(Array)
|
53
|
+
snapshot = get_snapshot(snap, name)
|
54
|
+
elsif snap.name == name
|
55
|
+
snapshot = snap.snapshot
|
56
|
+
end
|
57
|
+
end
|
58
|
+
snapshot
|
59
|
+
end
|
60
|
+
|
61
|
+
def initialize(name, snaphash)
|
62
|
+
@name = name
|
63
|
+
@snapshot = MockRbVmomiSnapshot.new
|
64
|
+
@snapshot.name = name
|
65
|
+
@snapshot.rootSnapshotList = process_snaphash(snaphash)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class MockRbVmomiConnection
|
70
|
+
class CustomizationSpecManager
|
71
|
+
class CustomizationSpec
|
72
|
+
def spec
|
73
|
+
true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def initialize
|
78
|
+
@customizationspec = CustomizationSpec.new
|
79
|
+
end
|
80
|
+
|
81
|
+
def GetCustomizationSpec(_arg)
|
82
|
+
@customizationspec
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class PropertyCollector
|
87
|
+
class Result
|
88
|
+
def initialize(name, object)
|
89
|
+
@name = name
|
90
|
+
@object = object
|
91
|
+
end
|
92
|
+
|
93
|
+
def val
|
94
|
+
@name
|
95
|
+
end
|
96
|
+
|
97
|
+
def obj
|
98
|
+
@object
|
99
|
+
end
|
100
|
+
|
101
|
+
def propSet
|
102
|
+
[self]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class ResultContainer
|
107
|
+
attr_accessor :token
|
108
|
+
|
109
|
+
def initialize
|
110
|
+
@results = []
|
111
|
+
end
|
112
|
+
|
113
|
+
def objects
|
114
|
+
@results
|
115
|
+
end
|
116
|
+
|
117
|
+
def add_object(obj)
|
118
|
+
@results << obj
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def initialize
|
123
|
+
@results = ResultContainer.new
|
124
|
+
end
|
125
|
+
|
126
|
+
def RetrievePropertiesEx(_hash)
|
127
|
+
@results.token = true
|
128
|
+
@results
|
129
|
+
end
|
130
|
+
|
131
|
+
def ContinueRetrievePropertiesEx(_token)
|
132
|
+
@results.token = false
|
133
|
+
@results
|
134
|
+
end
|
135
|
+
|
136
|
+
def add_result(name, object)
|
137
|
+
@results.add_object(Result.new(name, object))
|
138
|
+
end
|
139
|
+
|
140
|
+
def WaitForUpdates(_arg)
|
141
|
+
result = OpenStruct.new
|
142
|
+
result.version = 'version'
|
143
|
+
result
|
144
|
+
end
|
145
|
+
|
146
|
+
def CreateFilter(_arg)
|
147
|
+
filter = OpenStruct.new
|
148
|
+
filter.DestroyPropertyFilter = true
|
149
|
+
filter
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
class ServiceInstance
|
154
|
+
class Datacenter
|
155
|
+
attr_accessor :vmFolder, :hostFolder
|
156
|
+
|
157
|
+
def initialize
|
158
|
+
@vmFolder = MockRbVmomi::VIM::Folder.new
|
159
|
+
@vmFolder.name = '/root'
|
160
|
+
end
|
161
|
+
|
162
|
+
def find_datastore(_arg)
|
163
|
+
true
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def initialize
|
168
|
+
@datacenter = Datacenter.new
|
169
|
+
end
|
170
|
+
|
171
|
+
def find_datacenter(_dc)
|
172
|
+
@datacenter
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
class ServiceManager
|
177
|
+
class ViewManager
|
178
|
+
def CreateContainerView(hash)
|
179
|
+
@view = hash
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def initialize
|
184
|
+
@customizationspecmanager = CustomizationSpecManager.new
|
185
|
+
@viewmanager = ViewManager.new
|
186
|
+
end
|
187
|
+
|
188
|
+
def customizationSpecManager
|
189
|
+
@customizationspecmanager
|
190
|
+
end
|
191
|
+
|
192
|
+
def viewManager
|
193
|
+
@viewmanager
|
194
|
+
end
|
195
|
+
|
196
|
+
def rootFolder
|
197
|
+
'/root'
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def initialize(opts)
|
202
|
+
@host = opts[:host]
|
203
|
+
@user = opts[:user]
|
204
|
+
@password = opts[:password]
|
205
|
+
@insecure = opts[:insecure]
|
206
|
+
@serviceinstance = ServiceInstance.new
|
207
|
+
@servicemanager = ServiceManager.new
|
208
|
+
@propertycollector = PropertyCollector.new
|
209
|
+
end
|
210
|
+
|
211
|
+
def serviceInstance
|
212
|
+
@serviceinstance
|
213
|
+
end
|
214
|
+
|
215
|
+
def serviceContent
|
216
|
+
@servicemanager
|
217
|
+
end
|
218
|
+
|
219
|
+
def propertyCollector
|
220
|
+
@propertycollector
|
221
|
+
end
|
222
|
+
|
223
|
+
def set_info(vms)
|
224
|
+
vms.each do |vm|
|
225
|
+
@propertycollector.add_result(vm.name, vm)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
class MockRbVmomi
|
231
|
+
class VIM
|
232
|
+
class Folder
|
233
|
+
attr_accessor :name
|
234
|
+
|
235
|
+
def find
|
236
|
+
self
|
237
|
+
end
|
238
|
+
|
239
|
+
def childEntity
|
240
|
+
self
|
241
|
+
end
|
242
|
+
|
243
|
+
def resourcePool
|
244
|
+
self
|
245
|
+
end
|
246
|
+
|
247
|
+
def traverse(_path, _type = Object, _create = false)
|
248
|
+
self
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
class ResourcePool
|
253
|
+
attr_accessor :name
|
254
|
+
|
255
|
+
def find
|
256
|
+
self
|
257
|
+
end
|
258
|
+
|
259
|
+
def resourcePool
|
260
|
+
self
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
class ClusterComputeResource
|
265
|
+
attr_accessor :name
|
266
|
+
|
267
|
+
def find
|
268
|
+
self
|
269
|
+
end
|
270
|
+
|
271
|
+
def resourcePool
|
272
|
+
self
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
class TraversalSpec
|
277
|
+
def initialize(hash); end
|
278
|
+
end
|
279
|
+
|
280
|
+
def self.connect(opts)
|
281
|
+
MockRbVmomiConnection.new(opts)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
class MockVsphereSnapshot
|
2
|
+
attr_accessor :name
|
3
|
+
|
4
|
+
def RevertToSnapshot_Task
|
5
|
+
self
|
6
|
+
end
|
7
|
+
|
8
|
+
def wait_for_completion
|
9
|
+
true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class MockVsphereVM
|
14
|
+
attr_accessor :name, :powerState, :snapshot, :template, :toolsRunningStatus
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@powerState = 'poweredOff'
|
18
|
+
@toolsRunningStatus = 'guestToolsStopped'
|
19
|
+
@first = true
|
20
|
+
end
|
21
|
+
|
22
|
+
def runtime
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader :powerState
|
27
|
+
|
28
|
+
def toolsRunningStatus
|
29
|
+
prev = @toolsRunningStatus
|
30
|
+
@toolsRunningStatus = 'guestToolsRunning'
|
31
|
+
prev
|
32
|
+
end
|
33
|
+
|
34
|
+
def PowerOnVM_Task
|
35
|
+
@powerState = 'poweredOn'
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
def PowerOffVM_Task
|
40
|
+
@powerState = 'poweredOff'
|
41
|
+
self
|
42
|
+
end
|
43
|
+
|
44
|
+
def summary
|
45
|
+
self
|
46
|
+
end
|
47
|
+
|
48
|
+
def guest
|
49
|
+
self
|
50
|
+
end
|
51
|
+
|
52
|
+
def ipAddress
|
53
|
+
@toolsRunningStatus = 'guestToolsRunning'
|
54
|
+
"#{@name}.ip.address"
|
55
|
+
end
|
56
|
+
|
57
|
+
def CloneVM_Task(opts)
|
58
|
+
clone = MockVsphereVM.new
|
59
|
+
clone.name = opts[:name]
|
60
|
+
clone.snapshot = snapshot
|
61
|
+
clone.template = template
|
62
|
+
clone.PowerOnVM_Task
|
63
|
+
MockVsphereHelper.add_vm(opts[:name], clone)
|
64
|
+
clone
|
65
|
+
end
|
66
|
+
|
67
|
+
def wait_for_completion
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
def Destroy_Task
|
72
|
+
true
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
class MockVsphereHelper
|
77
|
+
@@fog_file = {}
|
78
|
+
@@vms = {}
|
79
|
+
|
80
|
+
def initialize(arg); end
|
81
|
+
|
82
|
+
def self.add_vm(name, vm)
|
83
|
+
@@vms[name] = vm
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.set_config(conf)
|
87
|
+
@@fog_file = conf
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.powerOn
|
91
|
+
@@vms.each do |_name, vm|
|
92
|
+
vm.powerState = 'poweredOn'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.powerOff
|
97
|
+
@@vms.each do |_name, vm|
|
98
|
+
vm.powerState = 'poweredOff'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.set_vms(hosts)
|
103
|
+
@@vms = {}
|
104
|
+
hosts.each do |host|
|
105
|
+
vm = MockVsphereVM.new
|
106
|
+
vm.name = host.name
|
107
|
+
vm.snapshot = MockVsphereSnapshot.new
|
108
|
+
vm.snapshot.name = host[:snapshot]
|
109
|
+
@@vms[host.name] = vm
|
110
|
+
template = MockVsphereVM.new
|
111
|
+
template.name = host[:template]
|
112
|
+
template.snapshot = MockVsphereSnapshot.new
|
113
|
+
template.snapshot.name = host[:snapshot]
|
114
|
+
@@vms[host[:template]] = template
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.load_config(_file)
|
119
|
+
@@fog_file
|
120
|
+
end
|
121
|
+
|
122
|
+
def find_vms(keys)
|
123
|
+
found = {}
|
124
|
+
keys = ([] << keys)
|
125
|
+
keys.flatten!
|
126
|
+
keys.each do |key|
|
127
|
+
found[key] = @@vms[key] if @@vms.has_key?(key)
|
128
|
+
end
|
129
|
+
found
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.find_vm(key)
|
133
|
+
return unless @@vms.has_key?(key)
|
134
|
+
|
135
|
+
@@vms[key]
|
136
|
+
end
|
137
|
+
|
138
|
+
def find_snapshot(vm, snap)
|
139
|
+
return unless @@vms[vm.name].snapshot.name == snap
|
140
|
+
|
141
|
+
@@vms[vm.name].snapshot
|
142
|
+
end
|
143
|
+
|
144
|
+
def find_customization(_template)
|
145
|
+
nil
|
146
|
+
end
|
147
|
+
|
148
|
+
def find_datastore(_dc, datastore)
|
149
|
+
datastore
|
150
|
+
end
|
151
|
+
|
152
|
+
def find_pool(_dc, pool)
|
153
|
+
pool
|
154
|
+
end
|
155
|
+
|
156
|
+
def find_folder(_dc, folder)
|
157
|
+
folder
|
158
|
+
end
|
159
|
+
|
160
|
+
def wait_for_tasks(_tasks, _try, _attempts)
|
161
|
+
true
|
162
|
+
end
|
163
|
+
|
164
|
+
def close
|
165
|
+
true
|
166
|
+
end
|
167
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,33 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
require 'rspec/its'
|
3
1
|
require 'beaker'
|
2
|
+
require 'mock_fission'
|
3
|
+
require 'mock_vsphere'
|
4
|
+
require 'mock_vsphere_helper'
|
4
5
|
|
5
|
-
|
6
|
+
begin
|
7
|
+
require 'simplecov'
|
8
|
+
require 'simplecov-console'
|
9
|
+
require 'codecov'
|
10
|
+
rescue LoadError
|
11
|
+
# Do nothing if no required gem installed
|
12
|
+
else
|
13
|
+
SimpleCov.start do
|
14
|
+
track_files 'lib/**/*.rb'
|
15
|
+
|
16
|
+
add_filter '/spec'
|
17
|
+
# do not track vendored files
|
18
|
+
add_filter '/vendor'
|
19
|
+
add_filter '/.vendor'
|
20
|
+
|
21
|
+
enable_coverage :branch
|
22
|
+
end
|
23
|
+
|
24
|
+
SimpleCov.formatters = [
|
25
|
+
SimpleCov::Formatter::Console,
|
26
|
+
SimpleCov::Formatter::Codecov,
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
Dir['./lib/beaker/hypervisor/*.rb'].sort.each { |file| require file }
|
6
31
|
|
7
32
|
# setup & require beaker's spec_helper.rb
|
8
33
|
beaker_gem_spec = Gem::Specification.find_by_name('beaker')
|