beaker-vmware 1.0.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 +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +27 -6
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +266 -0
- data/.simplecov +1 -1
- data/CHANGELOG.md +20 -0
- data/Gemfile +4 -23
- data/Rakefile +26 -125
- data/beaker-vmware.gemspec +20 -21
- 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 +9 -7
- metadata +77 -32
data/beaker-vmware.gemspec
CHANGED
@@ -1,35 +1,34 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
1
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
3
2
|
require 'beaker-vmware/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
5
|
+
s.name = 'beaker-vmware'
|
7
6
|
s.version = BeakerVmware::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.homepage =
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
7
|
+
s.authors = ['Vox Pupuli']
|
8
|
+
s.email = ['voxpupuli@groups.io']
|
9
|
+
s.homepage = 'https://github.com/voxpupuli/beaker-vmware'
|
10
|
+
s.summary = 'Beaker DSL Extension Helpers!'
|
11
|
+
s.description = 'For use for the Beaker acceptance testing tool'
|
13
12
|
s.license = 'Apache2'
|
14
13
|
|
15
14
|
s.files = `git ls-files`.split("\n")
|
16
|
-
s.
|
17
|
-
s.
|
18
|
-
|
15
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
|
18
|
+
s.required_ruby_version = Gem::Requirement.new('>= 2.7')
|
19
19
|
|
20
20
|
# Testing dependencies
|
21
|
+
s.add_development_dependency 'fakefs', '~> 2.4'
|
22
|
+
s.add_development_dependency 'rake'
|
21
23
|
s.add_development_dependency 'rspec', '~> 3.0'
|
22
24
|
s.add_development_dependency 'rspec-its'
|
23
|
-
s.add_development_dependency '
|
24
|
-
s.add_development_dependency '
|
25
|
-
|
26
|
-
|
27
|
-
s.add_development_dependency 'yard'
|
28
|
-
s.add_development_dependency 'markdown'
|
29
|
-
s.add_development_dependency 'thin'
|
30
|
-
|
25
|
+
s.add_development_dependency 'rubocop', '~> 1.48.1'
|
26
|
+
s.add_development_dependency 'rubocop-performance', '~> 1.10'
|
27
|
+
s.add_development_dependency 'rubocop-rake', '~> 0.2'
|
28
|
+
s.add_development_dependency 'rubocop-rspec', '>= 1.44'
|
31
29
|
# Run time dependencies
|
32
|
-
s.add_runtime_dependency '
|
30
|
+
s.add_runtime_dependency 'beaker', '>= 4', '< 6'
|
33
31
|
s.add_runtime_dependency 'fission', '~> 0.4'
|
34
|
-
s.add_runtime_dependency 'rbvmomi', '
|
32
|
+
s.add_runtime_dependency 'rbvmomi', '>= 1.9', '< 4.0'
|
33
|
+
s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
|
35
34
|
end
|
data/bin/beaker-vmware
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
module Beaker
|
2
2
|
class Fusion < Beaker::Hypervisor
|
3
|
-
|
4
3
|
def initialize(fusion_hosts, options)
|
5
4
|
require 'rubygems' unless defined?(Gem)
|
6
5
|
begin
|
7
6
|
require 'fission'
|
8
7
|
rescue LoadError
|
9
|
-
raise
|
8
|
+
raise 'Unable to load fission, please ensure it is installed!'
|
10
9
|
end
|
11
10
|
@logger = options[:logger]
|
12
11
|
@options = options
|
13
12
|
@hosts = fusion_hosts
|
14
|
-
#check preconditions for fusion
|
13
|
+
# check preconditions for fusion
|
15
14
|
@hosts.each do |host|
|
16
|
-
|
15
|
+
unless host['snapshot']
|
16
|
+
raise "You must specify a snapshot for Fusion instances, no snapshot defined for #{host.name}!"
|
17
|
+
end
|
17
18
|
end
|
18
19
|
@fission = Fission::VM
|
19
20
|
end
|
20
21
|
|
21
22
|
def provision
|
22
|
-
available = @fission.all.data.collect{|vm| vm.name}.sort.join(
|
23
|
+
available = @fission.all.data.collect { |vm| vm.name }.sort.join(', ')
|
23
24
|
@logger.notify "Available VM names: #{available}"
|
24
25
|
|
25
26
|
@hosts.each do |host|
|
26
|
-
vm_name = host[
|
27
|
+
vm_name = host['vmname'] || host.name
|
27
28
|
vm = @fission.new vm_name
|
28
29
|
raise "Could not find VM '#{vm_name}' for #{host.name}!" unless vm.exists?
|
29
30
|
|
@@ -32,34 +33,31 @@ module Beaker
|
|
32
33
|
raise "No snapshots available for VM #{host.name} (vmname: '#{vm_name}')"
|
33
34
|
end
|
34
35
|
|
35
|
-
available_snapshots = vm_snapshots.sort.join(
|
36
|
+
available_snapshots = vm_snapshots.sort.join(', ')
|
36
37
|
@logger.notify "Available snapshots for #{host.name}: #{available_snapshots}"
|
37
|
-
snap_name = host[
|
38
|
-
|
38
|
+
snap_name = host['snapshot']
|
39
|
+
unless vm.snapshots.data.include? snap_name
|
40
|
+
raise "Could not find snapshot '#{snap_name}' for host #{host.name}!"
|
41
|
+
end
|
39
42
|
|
40
43
|
@logger.notify "Reverting #{host.name} to snapshot '#{snap_name}'"
|
41
44
|
start = Time.now
|
42
45
|
vm.revert_to_snapshot snap_name
|
43
|
-
while vm.running?.data
|
44
|
-
sleep 1
|
45
|
-
end
|
46
|
+
sleep 1 while vm.running?.data
|
46
47
|
time = Time.now - start
|
47
|
-
@logger.notify
|
48
|
+
@logger.notify 'Spent %.2f seconds reverting' % time
|
48
49
|
|
49
50
|
@logger.notify "Resuming #{host.name}"
|
50
51
|
start = Time.now
|
51
|
-
vm.start :
|
52
|
-
until vm.running?.data
|
53
|
-
sleep 1
|
54
|
-
end
|
52
|
+
vm.start headless: true
|
53
|
+
sleep 1 until vm.running?.data
|
55
54
|
time = Time.now - start
|
56
|
-
@logger.notify
|
57
|
-
end
|
58
|
-
end #revert_fusion
|
59
|
-
|
60
|
-
def cleanup
|
61
|
-
@logger.notify "No cleanup for fusion boxes"
|
55
|
+
@logger.notify 'Spent %.2f seconds resuming VM' % time
|
62
56
|
end
|
57
|
+
end # revert_fusion
|
63
58
|
|
59
|
+
def cleanup
|
60
|
+
@logger.notify 'No cleanup for fusion boxes'
|
61
|
+
end
|
64
62
|
end
|
65
63
|
end
|
@@ -3,7 +3,6 @@ require 'beaker/hypervisor/vsphere_helper'
|
|
3
3
|
|
4
4
|
module Beaker
|
5
5
|
class Vsphere < Beaker::Hypervisor
|
6
|
-
|
7
6
|
def initialize(vsphere_hosts, options)
|
8
7
|
@options = options
|
9
8
|
@logger = options[:logger]
|
@@ -14,14 +13,14 @@ module Beaker
|
|
14
13
|
vsphere_credentials = VsphereHelper.load_config(@options[:dot_fog])
|
15
14
|
|
16
15
|
@logger.notify "Connecting to vSphere at #{vsphere_credentials[:server]}" +
|
17
|
-
|
16
|
+
" with credentials for #{vsphere_credentials[:user]}"
|
18
17
|
|
19
|
-
vsphere_helper = VsphereHelper.new(
|
18
|
+
vsphere_helper = VsphereHelper.new(vsphere_credentials)
|
20
19
|
|
21
20
|
vsphere_vms = {}
|
22
21
|
@hosts.each do |h|
|
23
|
-
name = h[
|
24
|
-
vsphere_vms[name] = h[
|
22
|
+
name = h['vmname'] || h.name
|
23
|
+
vsphere_vms[name] = h['snapshot']
|
25
24
|
end
|
26
25
|
vms = vsphere_helper.find_vms(vsphere_vms.keys)
|
27
26
|
vsphere_vms.each_pair do |name, snap|
|
@@ -40,47 +39,47 @@ module Beaker
|
|
40
39
|
snapshot.RevertToSnapshot_Task.wait_for_completion
|
41
40
|
|
42
41
|
time = Time.now - start
|
43
|
-
@logger.notify
|
42
|
+
@logger.notify 'Spent %.2f seconds reverting' % time
|
44
43
|
end
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
next if vm.runtime.powerState == 'poweredOn'
|
46
|
+
|
47
|
+
@logger.notify "Booting #{vm.name}"
|
48
|
+
start = Time.now
|
49
|
+
vm.PowerOnVM_Task.wait_for_completion
|
50
|
+
@logger.notify format("Spent %.2f seconds booting #{vm.name}", (Time.now - start))
|
52
51
|
end
|
53
52
|
|
54
53
|
vsphere_helper.close
|
55
54
|
end
|
56
55
|
|
57
56
|
def cleanup
|
58
|
-
@logger.notify
|
57
|
+
@logger.notify 'Destroying vsphere boxes'
|
59
58
|
vsphere_credentials = VsphereHelper.load_config(@options[:dot_fog])
|
60
59
|
|
61
60
|
@logger.notify "Connecting to vSphere at #{vsphere_credentials[:server]}" +
|
62
|
-
|
61
|
+
" with credentials for #{vsphere_credentials[:user]}"
|
63
62
|
|
64
|
-
vsphere_helper = VsphereHelper.new(
|
63
|
+
vsphere_helper = VsphereHelper.new(vsphere_credentials)
|
65
64
|
|
66
|
-
vm_names = @hosts.map {|h| h['vmname'] || h.name }
|
65
|
+
vm_names = @hosts.map { |h| h['vmname'] || h.name }
|
67
66
|
vms = vsphere_helper.find_vms vm_names
|
68
67
|
vm_names.each do |name|
|
69
68
|
unless vm = vms[name]
|
70
69
|
raise "Couldn't find VM #{name} in vSphere!"
|
71
70
|
end
|
72
71
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
72
|
+
next unless vm.runtime.powerState == 'poweredOn'
|
73
|
+
|
74
|
+
@logger.notify "Shutting down #{vm.name}"
|
75
|
+
start = Time.now
|
76
|
+
vm.PowerOffVM_Task.wait_for_completion
|
77
|
+
@logger.notify(
|
78
|
+
format("Spent %.2f seconds halting #{vm.name}", (Time.now - start)),
|
79
|
+
)
|
80
80
|
end
|
81
81
|
|
82
82
|
vsphere_helper.close
|
83
83
|
end
|
84
|
-
|
85
84
|
end
|
86
85
|
end
|
@@ -3,12 +3,12 @@ require 'rbvmomi'
|
|
3
3
|
require 'beaker/logger'
|
4
4
|
|
5
5
|
class VsphereHelper
|
6
|
-
def initialize
|
6
|
+
def initialize(vInfo)
|
7
7
|
@logger = vInfo[:logger] || Beaker::Logger.new
|
8
|
-
@connection = RbVmomi::VIM.connect :
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
8
|
+
@connection = RbVmomi::VIM.connect host: vInfo[:server],
|
9
|
+
user: vInfo[:user],
|
10
|
+
password: vInfo[:pass],
|
11
|
+
insecure: true
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.load_config(dot_fog = '.fog')
|
@@ -19,121 +19,121 @@ class VsphereHelper
|
|
19
19
|
vsphere_credentials[:user] = default[:vsphere_username]
|
20
20
|
vsphere_credentials[:pass] = default[:vsphere_password]
|
21
21
|
|
22
|
-
|
22
|
+
vsphere_credentials
|
23
23
|
end
|
24
24
|
|
25
|
-
def find_snapshot
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
raise "vm #{vm.name} has no snapshots to revert to"
|
30
|
-
end
|
25
|
+
def find_snapshot(vm, snapname)
|
26
|
+
raise "vm #{vm.name} has no snapshots to revert to" unless vm.snapshot
|
27
|
+
|
28
|
+
search_child_snaps vm.snapshot.rootSnapshotList, snapname
|
31
29
|
end
|
32
30
|
|
33
|
-
def search_child_snaps
|
31
|
+
def search_child_snaps(tree, snapname)
|
34
32
|
snapshot = nil
|
35
33
|
tree.each do |child|
|
36
|
-
if child.name == snapname
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
34
|
+
snapshot ||= if child.name == snapname
|
35
|
+
child.snapshot
|
36
|
+
else
|
37
|
+
search_child_snaps child.childSnapshotList, snapname
|
38
|
+
end
|
41
39
|
end
|
42
40
|
snapshot
|
43
41
|
end
|
44
42
|
|
45
|
-
def find_customization
|
43
|
+
def find_customization(name)
|
46
44
|
csm = @connection.serviceContent.customizationSpecManager
|
47
45
|
|
48
46
|
begin
|
49
|
-
customizationSpec = csm.GetCustomizationSpec({:name
|
50
|
-
rescue
|
47
|
+
customizationSpec = csm.GetCustomizationSpec({ name: name }).spec
|
48
|
+
rescue StandardError
|
51
49
|
customizationSpec = nil
|
52
50
|
end
|
53
51
|
|
54
|
-
|
52
|
+
customizationSpec
|
55
53
|
end
|
56
54
|
|
57
55
|
# an easier wrapper around the horrid PropertyCollector interface,
|
58
56
|
# necessary for searching VMs in all Datacenters that may be nested
|
59
57
|
# within folders of arbitrary depth
|
60
58
|
# returns a hash array of <name> => <VirtualMachine ManagedObjects>
|
61
|
-
def find_vms
|
62
|
-
names = names.is_a?(Array)
|
59
|
+
def find_vms(names, connection = @connection)
|
60
|
+
names = [names] unless names.is_a?(Array)
|
63
61
|
containerView = get_base_vm_container_from connection
|
64
62
|
propertyCollector = connection.propertyCollector
|
65
63
|
|
66
64
|
objectSet = [{
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
65
|
+
obj: containerView,
|
66
|
+
skip: true,
|
67
|
+
selectSet: [RbVmomi::VIM::TraversalSpec.new({
|
68
|
+
name: 'gettingTheVMs',
|
69
|
+
path: 'view',
|
70
|
+
skip: false,
|
71
|
+
type: 'ContainerView',
|
72
|
+
})],
|
75
73
|
}]
|
76
74
|
|
77
75
|
propSet = [{
|
78
|
-
:
|
79
|
-
:
|
76
|
+
pathSet: ['name'],
|
77
|
+
type: 'VirtualMachine',
|
80
78
|
}]
|
81
79
|
|
82
80
|
results = propertyCollector.RetrievePropertiesEx({
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
specSet: [{
|
82
|
+
objectSet: objectSet,
|
83
|
+
propSet: propSet,
|
84
|
+
}],
|
85
|
+
options: { maxObjects: nil },
|
86
|
+
})
|
89
87
|
|
90
88
|
vms = {}
|
91
89
|
results.objects.each do |result|
|
92
90
|
name = result.propSet.first.val
|
93
91
|
next unless names.include? name
|
92
|
+
|
94
93
|
vms[name] = result.obj
|
95
94
|
end
|
96
95
|
|
97
|
-
while results.token
|
98
|
-
results = propertyCollector.ContinueRetrievePropertiesEx({:
|
96
|
+
while results.token
|
97
|
+
results = propertyCollector.ContinueRetrievePropertiesEx({ token: results.token })
|
99
98
|
results.objects.each do |result|
|
100
99
|
name = result.propSet.first.val
|
101
100
|
next unless names.include? name
|
101
|
+
|
102
102
|
vms[name] = result.obj
|
103
103
|
end
|
104
104
|
end
|
105
105
|
vms
|
106
106
|
end
|
107
107
|
|
108
|
-
def find_datastore(dc,datastorename)
|
108
|
+
def find_datastore(dc, datastorename)
|
109
109
|
datacenter = @connection.serviceInstance.find_datacenter(dc)
|
110
110
|
datacenter.find_datastore(datastorename)
|
111
111
|
end
|
112
112
|
|
113
|
-
def find_folder(dc,foldername)
|
113
|
+
def find_folder(dc, foldername)
|
114
114
|
datacenter = @connection.serviceInstance.find_datacenter(dc)
|
115
115
|
base = datacenter.vmFolder.traverse(foldername)
|
116
|
-
if base
|
117
|
-
base
|
118
|
-
else
|
116
|
+
if base.nil?
|
119
117
|
abort "Failed to find folder #{foldername}"
|
118
|
+
else
|
119
|
+
base
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
-
def find_pool(dc,poolname)
|
123
|
+
def find_pool(dc, poolname)
|
124
124
|
datacenter = @connection.serviceInstance.find_datacenter(dc)
|
125
125
|
base = datacenter.hostFolder
|
126
126
|
pools = poolname.split('/')
|
127
127
|
pools.each do |pool|
|
128
128
|
case base
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
129
|
+
when RbVmomi::VIM::Folder
|
130
|
+
base = base.childEntity.find { |f| f.name == pool }
|
131
|
+
when RbVmomi::VIM::ClusterComputeResource
|
132
|
+
base = base.resourcePool.resourcePool.find { |f| f.name == pool }
|
133
|
+
when RbVmomi::VIM::ResourcePool
|
134
|
+
base = base.resourcePool.find { |f| f.name == pool }
|
135
|
+
else
|
136
|
+
abort "Unexpected object type encountered (#{base.class}) while finding resource pool"
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -141,43 +141,41 @@ class VsphereHelper
|
|
141
141
|
base
|
142
142
|
end
|
143
143
|
|
144
|
-
def get_base_vm_container_from
|
144
|
+
def get_base_vm_container_from(connection)
|
145
145
|
viewManager = connection.serviceContent.viewManager
|
146
146
|
viewManager.CreateContainerView({
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
147
|
+
container: connection.serviceContent.rootFolder,
|
148
|
+
recursive: true,
|
149
|
+
type: ['VirtualMachine'],
|
150
|
+
})
|
151
151
|
end
|
152
152
|
|
153
|
-
def wait_for_tasks
|
154
|
-
obj_set = tasks.map { |task| { :
|
153
|
+
def wait_for_tasks(tasks, try, attempts)
|
154
|
+
obj_set = tasks.map { |task| { obj: task } }
|
155
155
|
filter = @connection.propertyCollector.CreateFilter(
|
156
|
-
:
|
157
|
-
:
|
158
|
-
|
159
|
-
|
160
|
-
:
|
156
|
+
spec: {
|
157
|
+
propSet: [{ type: 'Task',
|
158
|
+
all: false,
|
159
|
+
pathSet: ['info.state'], }],
|
160
|
+
objectSet: obj_set,
|
161
161
|
},
|
162
|
-
:
|
162
|
+
partialUpdates: false,
|
163
163
|
)
|
164
164
|
ver = ''
|
165
165
|
while true
|
166
|
-
result = @connection.propertyCollector.WaitForUpdates(:
|
166
|
+
result = @connection.propertyCollector.WaitForUpdates(version: ver)
|
167
167
|
ver = result.version
|
168
168
|
complete = 0
|
169
169
|
tasks.each do |task|
|
170
|
-
if [
|
171
|
-
complete += 1
|
172
|
-
end
|
173
|
-
end
|
174
|
-
break if (complete == tasks.length)
|
175
|
-
if try <= attempts
|
176
|
-
sleep 5
|
177
|
-
try += 1
|
178
|
-
else
|
179
|
-
raise "unable to complete Vsphere tasks before timeout"
|
170
|
+
complete += 1 if %w[success error].member? task.info.state
|
180
171
|
end
|
172
|
+
break if complete == tasks.length
|
173
|
+
|
174
|
+
raise 'unable to complete Vsphere tasks before timeout' unless try <= attempts
|
175
|
+
|
176
|
+
sleep 5
|
177
|
+
try += 1
|
178
|
+
|
181
179
|
end
|
182
180
|
|
183
181
|
filter.DestroyPropertyFilter
|
@@ -188,4 +186,3 @@ class VsphereHelper
|
|
188
186
|
@connection.close
|
189
187
|
end
|
190
188
|
end
|
191
|
-
|
@@ -2,40 +2,38 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Beaker
|
4
4
|
describe Fusion do
|
5
|
-
let(
|
6
|
-
|
7
|
-
before
|
8
|
-
|
9
|
-
@hosts = make_hosts
|
10
|
-
MockFission.presets(
|
11
|
-
allow_any_instance_of(
|
12
|
-
fusion.instance_variable_set(
|
5
|
+
let(:fusion) { Beaker::Fusion.new(@hosts, make_opts) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
stub_const('Fission::VM', true)
|
9
|
+
@hosts = make_hosts
|
10
|
+
MockFission.presets(@hosts)
|
11
|
+
allow_any_instance_of(Fusion).to receive(:require).with('fission').and_return(true)
|
12
|
+
fusion.instance_variable_set(:@fission, MockFission)
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it 'can interoperate with the fission library to provision hosts' do
|
16
16
|
fusion.provision
|
17
17
|
end
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'raises an error if unknown snapshot name is used' do
|
20
20
|
@hosts[0][:snapshot] = 'unknown'
|
21
|
-
expect{ fusion.provision }.to raise_error
|
21
|
+
expect { fusion.provision }.to raise_error
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'raises an error if snapshots is nil' do
|
25
25
|
MockFissionVM.set_snapshots(nil)
|
26
|
-
expect{ fusion.provision }.to raise_error(/No snapshots available/)
|
26
|
+
expect { fusion.provision }.to raise_error(/No snapshots available/)
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'raises an error if snapshots are empty' do
|
30
30
|
MockFissionVM.set_snapshots([])
|
31
|
-
expect{ fusion.provision }.to raise_error(/No snapshots available/)
|
31
|
+
expect { fusion.provision }.to raise_error(/No snapshots available/)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'host fails init with nil snapshot' do
|
35
35
|
@hosts[0][:snapshot] = nil
|
36
|
-
expect{ Beaker::Fusion.new(
|
36
|
+
expect { Beaker::Fusion.new(@hosts, make_opts) }.to raise_error(/specify a snapshot/)
|
37
37
|
end
|
38
|
-
|
39
38
|
end
|
40
|
-
|
41
39
|
end
|