add possibility to stub only selected providers
This commit is contained in:
parent
b01031acba
commit
3c8f5258d0
@ -39,7 +39,7 @@ module Devops
|
|||||||
Devops::Api2.settings.mongo.create_root_user
|
Devops::Api2.settings.mongo.create_root_user
|
||||||
::Provider::ProviderFactory.init(config)
|
::Provider::ProviderFactory.init(config)
|
||||||
|
|
||||||
Stubber.stub_providers! if config[:stub_classes]
|
Stubber.stub_providers!(config[:stub_providers])
|
||||||
end
|
end
|
||||||
|
|
||||||
def routes
|
def routes
|
||||||
|
|||||||
@ -40,4 +40,7 @@ config[:static_ssh_key] = "ssh_key" # or nil
|
|||||||
config[:static_certificate] = "/path/to/.ssh/static.pem"
|
config[:static_certificate] = "/path/to/.ssh/static.pem"
|
||||||
|
|
||||||
config[:debug] = true
|
config[:debug] = true
|
||||||
config[:stub_classes] = true
|
|
||||||
|
# set it to :all or [:ec2] to stub calls to selected providers
|
||||||
|
# or to false to disable stubbing
|
||||||
|
config[:stub_providers] = false
|
||||||
@ -1,5 +1,11 @@
|
|||||||
module Stubber
|
module Stubber
|
||||||
def self.stub_providers!
|
def self.stub_providers!(providers)
|
||||||
Dir["tests/stubs/providers/*.rb"].each {|file| require file }
|
return unless providers
|
||||||
|
|
||||||
|
providers = [:ec2, :openstack] if providers == :all
|
||||||
|
providers.each do |provider|
|
||||||
|
next unless [:ec2, :openstack].include?(provider)
|
||||||
|
require "tests/stubs/providers/#{provider}.rb"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user