1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/xenserver/models/compute/servers_tests.rb
Sergio Rubio b917ffc5db * Added more tests and extended existing ones
* Added missing exceptions NotFound and RequestFailed
* connection.request now raises exception if request failed
* refactored most get_* request into get_record and get_records
* Compute.default_template more robust
* Base parser now replaces OpaqueRef:NULL with nil
* create_server request fixes
2012-04-04 09:01:55 +02:00

38 lines
1.3 KiB
Ruby

Shindo.tests('Fog::Compute[:xenserver] | servers collection', ['xenserver']) do
#require 'pp'
conn = Fog::Compute[:xenserver]
# pre-flight cleanup
(conn.servers.all :name_matches => test_ephemeral_vm_name).each do |s|
s.destroy
end
# Create some test data
server = conn.servers.create(:name => test_ephemeral_vm_name,
:template_name => test_template_name)
server.wait_for { running? }
tests('The servers collection') do
servers = conn.servers.all
test('should not be empty') { !servers.empty? }
test('should be a kind of Fog::Compute::XenServer::Servers') { servers.kind_of? Fog::Compute::XenServer::Servers }
test('should be a kind of Fog::Compute::XenServer::Servers') { servers.kind_of? Fog::Compute::XenServer::Servers }
tests('should have Fog::Compute::XenServer::Servers inside') do
conn.servers.each do |s|
test { s.kind_of? Fog::Compute::XenServer::Server }
end
end
tests('should be able to reload itself').succeeds { servers.reload }
tests('should be able to get a model') do
tests('by name').succeeds { servers.get_by_name test_ephemeral_vm_name }
tests('by instance uuid').succeeds { servers.get(servers.get_by_name(test_ephemeral_vm_name).reference) }
end
end
end