mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add initial extra testing for cloudstack enhancements
This commit is contained in:
parent
09ac1f9005
commit
ea08946d02
9 changed files with 75 additions and 4 deletions
4
Rakefile
4
Rakefile
|
@ -72,6 +72,10 @@ namespace :test do
|
|||
task :openstack do
|
||||
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openstack")
|
||||
end
|
||||
task :cloudstack do
|
||||
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/cloudstack")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
desc 'Run mocked tests for a specific provider'
|
||||
|
|
|
@ -660,6 +660,7 @@ module Fog
|
|||
class Mock
|
||||
def initialize(options={})
|
||||
@cloudstack_api_key = options[:cloudstack_api_key]
|
||||
@cloudstack_project_id = Fog.credentials[:cloudstack_project_id] || Fog::Cloudstack.uuid
|
||||
end
|
||||
|
||||
def self.data
|
||||
|
@ -880,6 +881,16 @@ module Fog
|
|||
"storagetype" => "shared"
|
||||
}
|
||||
},
|
||||
:egress_firewall_rules => {
|
||||
"f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1" => {
|
||||
"id"=>"f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1",
|
||||
"protocol"=>"tcp",
|
||||
"networkid"=> network_id,
|
||||
"state"=>"Active",
|
||||
"cidrlist"=>"10.2.1.0/24",
|
||||
"tags"=>[]
|
||||
}
|
||||
},
|
||||
:os_types => {
|
||||
"51ef854d-279e-4e68-9059-74980fd7b29b" => {
|
||||
"id" => "51ef854d-279e-4e68-9059-74980fd7b29b",
|
||||
|
|
|
@ -24,7 +24,15 @@ module Fog
|
|||
def create_egress_firewall_rule(*args)
|
||||
egress_firewall_rule_id = Fog::Cloudstack.uuid
|
||||
|
||||
egress_firewall_rule = {}
|
||||
egress_firewall_rule = {
|
||||
"id" => egress_firewall_rule_id,
|
||||
"protocol" => "tcp",
|
||||
"networkid" => "f1f1f1-f1f1-f1f1f1-f1f1f1f1f1",
|
||||
"state" => "Active",
|
||||
"cidrlist" => "10.2.1.0/24",
|
||||
}
|
||||
|
||||
self.data[:egress_firewall_rules][egress_firewall_rule_id] = egress_firewall_rule
|
||||
|
||||
{'createegressfirewallruleresponse' => egress_firewall_rule}
|
||||
end
|
||||
|
|
|
@ -19,6 +19,15 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def delete_egress_firewall_rule(options={})
|
||||
egress_firewall_rule_id = options['id']
|
||||
data[:egress_firewall_rules].delete(egress_firewall_rule_id) if data[:egress_firewall_rules][egress_firewall_rule_id]
|
||||
|
||||
{ 'deleteegressfirewallruleresponse' => { 'success' => 'true' } }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,13 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def list_egress_firewall_rules(*arg)
|
||||
firewall_rules = self.data[:egress_firewall_rules]
|
||||
{ "listegressfirewallrulesresponse" => { "count"=> firewall_rules.count, "firewallrule"=> firewall_rules.values } }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Shindo.tests("Fog::Compute[:cloudstack] | egress_firewall_rule", "cloudstack") do
|
||||
config = compute_providers[:cloudstack]
|
||||
compute = Fog::Compute[:cloudstack]
|
||||
|
||||
model_tests(compute.egress_firewall_rules, config[:egress_firewall_rule_attributes], config[:mocked])
|
||||
end
|
25
tests/cloudstack/requests/egress_firewall_rule_tests.rb
Normal file
25
tests/cloudstack/requests/egress_firewall_rule_tests.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
Shindo.tests('Fog::Compute[:cloudstack] | egress firewall rule requests', ['cloudstack']) do
|
||||
|
||||
@egress_firewall_rules_format = {
|
||||
'listegressfirewallrulesresponse' => {
|
||||
'count' => Integer,
|
||||
'firewallrule' => [
|
||||
'id' => String,
|
||||
'protocol' => String,
|
||||
'networkid' => String,
|
||||
'state' => String,
|
||||
'cidrlist' => String,
|
||||
'tags' => Fog::Nullable::Array
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests('#list_egress_firewall_rules').formats(@egress_firewall_rules_format) do
|
||||
Fog::Compute[:cloudstack].list_egress_firewall_rules
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -55,7 +55,7 @@ def compute_providers
|
|||
:protocol => 'tcp'
|
||||
},
|
||||
:disk_offering_attributes => { :name => "new disk offering", :display_text => 'New Disk Offering' },
|
||||
:egress_firewall_rule_attributes => {:network_id => '89198f7c-0245-aa1d-136a-c5f479ef9db7', :protocol => 'tcp'},
|
||||
:egress_firewall_rule_attributes => { :protocol => "tcp", :network_id => "8aacae29-e0a4-4b7b-8a7a-3ee11cfb4362", :cidr_list =>"10.1.1.0/24"},
|
||||
:mocked => true
|
||||
},
|
||||
:glesys => {
|
||||
|
|
|
@ -23,6 +23,7 @@ if Fog.mock?
|
|||
:cloudstack_service_offering_id => '4437ac6c-9fe3-477a-57ec-60a5a45896a4',
|
||||
:cloudstack_template_id => '8a31cf9c-f248-0588-256e-9dbf58785216',
|
||||
:cloudstack_zone_id => 'c554c592-e09c-9df5-7688-4a32754a4305',
|
||||
:cloudstack_project_id => 'f1f1f1f1-f1f1-f1f1-f1f1-f1f1f1f1f1f1',
|
||||
:clodo_api_key => 'clodo_api_key',
|
||||
:clodo_username => 'clodo_username',
|
||||
:digitalocean_api_key => 'digitalocean_api_key',
|
||||
|
|
Loading…
Reference in a new issue