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/helper.rb
Sergio Rubio 49c14eb543 [xenserver] Added missing Server.tags attribute
Added support for Array parameters to Connection.request:

    server = connection.server.create :name => 'fooserver',
                                      :template_name => 'debian-squeeze'
    server.wait_for { ready? }
    server.set_attribute 'tags', ['tagfoo', 'tagbar']

Added required shindo test for set_attribute request.
2012-06-07 19:26:47 +02:00

36 lines
813 B
Ruby

def test_template_name
ENV['FOG_XENSERVER_TEMPLATE'] || 'squeeze-test'
end
def test_ephemeral_vm_name
'fog-test-server-shindo'
end
def valid_ref?(ref)
(ref =~ /OpaqueRef:/) and \
(ref != "OpaqueRef:NULL" )
end
def create_ephemeral_vm
Fog::Compute[:xenserver].servers.create(:name => test_ephemeral_vm_name,
:template_name => test_template_name)
end
def create_ephemeral_server
create_ephemeral_vm
end
def destroy_ephemeral_servers
servers = Fog::Compute[:xenserver].servers
# Teardown cleanup
(servers.all :name_matches => test_ephemeral_vm_name).each do |s|
s.destroy
end
(servers.templates.find_all { |t| t.name == test_ephemeral_vm_name}).each do |s|
s.destroy
end
end
def destroy_ephemeral_vms
destroy_ephemeral_servers
end