2012-04-12 07:17:58 -04:00
|
|
|
Shindo.tests('Fog::Compute[:xenserver] | set_attribute request', ['xenserver']) do
|
|
|
|
|
2012-04-19 04:53:56 -04:00
|
|
|
# Setup cleanup
|
|
|
|
destroy_ephemeral_servers
|
|
|
|
|
2012-04-12 07:17:58 -04:00
|
|
|
connection = Fog::Compute[:xenserver]
|
|
|
|
servers = connection.servers
|
2012-04-19 04:53:56 -04:00
|
|
|
server = create_ephemeral_server
|
|
|
|
|
2012-04-12 07:17:58 -04:00
|
|
|
tests('Setting an attribute with set_attribute should') do
|
|
|
|
test('set the PV_bootloader attr to foobar') do
|
2012-04-16 15:09:52 -04:00
|
|
|
response = connection.set_attribute('VM', server.reference, 'PV_bootloader', 'foobar')
|
2012-04-12 07:17:58 -04:00
|
|
|
server.reload
|
|
|
|
server.pv_bootloader == 'foobar'
|
|
|
|
end
|
|
|
|
test('set the PV-bootloader attr to stuff') do
|
2012-04-16 15:09:52 -04:00
|
|
|
response = connection.set_attribute('VM', server.reference, 'PV-bootloader', 'stuff')
|
2012-04-12 07:17:58 -04:00
|
|
|
server.reload
|
|
|
|
server.pv_bootloader == 'stuff'
|
|
|
|
end
|
|
|
|
test('set the other_config attr { "foo" => "bar", :stuff => "crap" }') do
|
2012-04-16 15:09:52 -04:00
|
|
|
response = connection.set_attribute('VM', server.reference, 'other_config', { "foo" => "bar", :stuff => 'crap' })
|
2012-04-12 07:17:58 -04:00
|
|
|
server.reload
|
|
|
|
(server.other_config['foo'] == 'bar') and \
|
|
|
|
(server.other_config['stuff'] == 'crap')
|
|
|
|
end
|
2012-04-19 04:53:56 -04:00
|
|
|
test('set the multiple valued attribute memory_limits }') do
|
|
|
|
server = create_ephemeral_server
|
|
|
|
server.stop 'hard'
|
|
|
|
server.wait_for { not running? }
|
|
|
|
response = connection.set_attribute('VM',
|
|
|
|
server.reference,
|
|
|
|
'memory_limits',
|
|
|
|
'1073741824',
|
|
|
|
'1073741824',
|
|
|
|
'1073741824',
|
|
|
|
'1073741824'
|
|
|
|
)
|
|
|
|
server.reload
|
|
|
|
(server.memory_dynamic_max == "1073741824") and \
|
|
|
|
(server.memory_dynamic_min == "1073741824") and \
|
|
|
|
(server.memory_static_max == "1073741824") and \
|
|
|
|
(server.memory_static_min == "1073741824")
|
|
|
|
|
|
|
|
server.start
|
|
|
|
end
|
2012-04-12 07:17:58 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests('The expected options') do
|
|
|
|
raises(ArgumentError, 'raises ArgumentError when ref,attr,value missing') { connection.get_record }
|
|
|
|
end
|
2012-04-19 04:53:56 -04:00
|
|
|
|
|
|
|
# Teardown cleanup
|
|
|
|
destroy_ephemeral_servers
|
|
|
|
|
2012-04-12 07:17:58 -04:00
|
|
|
end
|