Reduce maintenance of tests by using a dynamic list of providers
Added registered_providers which returns the providers Fog knows about Remove the providers for local VMs (not lacking credentials but installs)
This commit is contained in:
parent
6ee6aaad9a
commit
00ebbd3c88
|
@ -7,6 +7,10 @@ module Fog
|
||||||
@available_providers ||= Fog.providers.values.select {|provider| Kernel.const_get(provider).available?}.sort
|
@available_providers ||= Fog.providers.values.select {|provider| Kernel.const_get(provider).available?}.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def registered_providers
|
||||||
|
@registered_providers ||= Fog.providers.values.sort
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Bin
|
class Bin
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require 'fog'
|
require 'fog'
|
||||||
require 'fog/bin' # for available_providers
|
require 'fog/bin' # for available_providers and registered_providers
|
||||||
|
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper'))
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper'))
|
||||||
|
|
||||||
|
@ -12,9 +12,16 @@ def array_differences(array_a, array_b)
|
||||||
end
|
end
|
||||||
|
|
||||||
# check to see which credentials are available and add others to the skipped tags list
|
# check to see which credentials are available and add others to the skipped tags list
|
||||||
all_providers = ['aws', 'bare_metal_cloud', 'bluebox', 'brightbox', 'clodo', 'cloudstack', 'dnsimple', 'dnsmadeeasy', 'dynect', 'ecloud', 'glesys', 'gogrid', 'google', 'hp', 'ibm', 'joyent', 'linode', 'local', 'ninefold', 'openstack', 'ovirt', 'rackspace', 'stormondemand', 'vcloud', 'voxel', 'vsphere', 'xenserver', 'zerigo']
|
all_providers = Fog.registered_providers.map {|provider| provider.downcase}
|
||||||
|
|
||||||
|
# Manually remove these providers since they are local applications, not lacking credentials
|
||||||
|
all_providers = all_providers - ["libvirt", "virtualbox", "vmfusion"]
|
||||||
|
|
||||||
available_providers = Fog.available_providers.map {|provider| provider.downcase}
|
available_providers = Fog.available_providers.map {|provider| provider.downcase}
|
||||||
for provider in (all_providers - available_providers)
|
|
||||||
|
unavailable_providers = all_providers - available_providers
|
||||||
|
|
||||||
|
for provider in unavailable_providers
|
||||||
Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '~/.fog' to run them)[/]")
|
Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '~/.fog' to run them)[/]")
|
||||||
Thread.current[:tags] << ('-' << provider)
|
Thread.current[:tags] << ('-' << provider)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue