mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add assign list to load balancer rules and update load balancer rule for
Ninefold.
This commit is contained in:
parent
a5a3ee95f9
commit
fd41afa8f2
2 changed files with 68 additions and 8 deletions
|
@ -328,6 +328,39 @@ class Ninefold
|
||||||
"state"=>String,
|
"state"=>String,
|
||||||
"zoneid"=>Integer
|
"zoneid"=>Integer
|
||||||
}
|
}
|
||||||
|
ASSIGN_LOAD_BALANCER_RULE_RESPONSE = {
|
||||||
|
"success"=>Fog::Boolean
|
||||||
|
}
|
||||||
|
LIST_LOAD_BALANCER_RULES_RESPONSE = {
|
||||||
|
"id"=>Integer,
|
||||||
|
"name"=>String,
|
||||||
|
"publicipid"=>Integer,
|
||||||
|
"publicip"=>String,
|
||||||
|
"publicport"=>String,
|
||||||
|
"privateport"=>String,
|
||||||
|
"algorithm"=>String,
|
||||||
|
"cidrlist"=>String,
|
||||||
|
"account"=>String,
|
||||||
|
"domainid"=>Integer,
|
||||||
|
"domain"=>String,
|
||||||
|
"state"=>String,
|
||||||
|
"zoneid"=>Integer
|
||||||
|
}
|
||||||
|
UPDATE_LOAD_BALANCER_RULE_RESPONSE = {
|
||||||
|
"id"=>Integer,
|
||||||
|
"name"=>String,
|
||||||
|
"publicipid"=>Integer,
|
||||||
|
"publicip"=>String,
|
||||||
|
"publicport"=>String,
|
||||||
|
"privateport"=>String,
|
||||||
|
"algorithm"=>String,
|
||||||
|
"cidrlist"=>String,
|
||||||
|
"account"=>String,
|
||||||
|
"domainid"=>Integer,
|
||||||
|
"domain"=>String,
|
||||||
|
"state"=>String,
|
||||||
|
"zoneid"=>Integer
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,16 +3,43 @@ Shindo.tests('Fog::Compute[:ninefold] | load balancers', ['ninefold']) do
|
||||||
# NOTE: all of these tests require you to have a vm built with a public IP address.
|
# NOTE: all of these tests require you to have a vm built with a public IP address.
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
p Ninefold::Compute::Formats::LoadBalancers::CREATE_LOAD_BALANCER_RULE_RESPONSE
|
before do
|
||||||
|
@compute = Fog::Compute[:ninefold]
|
||||||
|
@public_ip_id = @compute.list_public_ip_addresses.first['id']
|
||||||
|
@server_id = @compute.servers.all.first.id
|
||||||
|
@create_load_balancer = @compute.create_load_balancer_rule(:algorithm => 'roundrobin', :name => 'test',
|
||||||
|
:privateport => 1000, :publicport => 2000,
|
||||||
|
:publicipid => @public_ip_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
delete = @compute.delete_load_balancer_rule id: @create_load_balancer['id']
|
||||||
|
Ninefold::Compute::TestSupport.wait_for_job(delete['jobid'])
|
||||||
|
end
|
||||||
|
|
||||||
tests("#create_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::CREATE_LOAD_BALANCER_RULE_RESPONSE) do
|
tests("#create_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::CREATE_LOAD_BALANCER_RULE_RESPONSE) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
compute = Fog::Compute[:ninefold]
|
result = Ninefold::Compute::TestSupport.wait_for_job(@create_load_balancer['jobid'])
|
||||||
public_ip_id = compute.list_public_ip_addresses.first['id']
|
result['jobresult']['loadbalancer']
|
||||||
create_load_balancer = compute.create_load_balancer_rule(:algorithm => 'roundrobin', :name => 'test',
|
end
|
||||||
:privateport => 1000, :publicport => 2000,
|
|
||||||
:publicipid => public_ip_id)
|
tests("#assign_to_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::ASSIGN_LOAD_BALANCER_RULE_RESPONSE) do
|
||||||
result = Ninefold::Compute::TestSupport.wait_for_job(create_load_balancer['jobid'])
|
pending if Fog.mocking?
|
||||||
compute.delete_load_balancer_rule id: create_load_balancer['id']
|
assign_load_balancer = @compute.assign_to_load_balancer_rule id: @create_load_balancer['id'], virtualmachineids: @server_id
|
||||||
|
result = Ninefold::Compute::TestSupport.wait_for_job(assign_load_balancer['jobid'])
|
||||||
|
result['jobresult']
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#list_to_load_balancer_rules()").formats(Ninefold::Compute::Formats::LoadBalancers::LIST_LOAD_BALANCER_RULES_RESPONSE) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
list_load_balancer_rules = @compute.list_load_balancer_rules
|
||||||
|
list_load_balancer_rules['loadbalancerrule'].first
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("#update_to_load_balancer_rule()").formats(Ninefold::Compute::Formats::LoadBalancers::UPDATE_LOAD_BALANCER_RULE_RESPONSE) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
update_load_balancer = @compute.update_load_balancer_rule id: @create_load_balancer['id'], algorithm: 'source'
|
||||||
|
result = Ninefold::Compute::TestSupport.wait_for_job(update_load_balancer['jobid'])
|
||||||
result['jobresult']['loadbalancer']
|
result['jobresult']['loadbalancer']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue