2011-01-10 14:12:48 +08:00
|
|
|
require 'fog'
|
2012-08-15 17:24:17 +01:00
|
|
|
require 'fog/bin' # for available_providers and registered_providers
|
2010-11-04 11:12:44 -07:00
|
|
|
|
2011-02-06 01:28:36 +08:00
|
|
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper'))
|
2010-11-21 09:02:34 -05:00
|
|
|
|
2011-01-21 17:42:56 -08:00
|
|
|
def lorem_file
|
|
|
|
File.open(File.dirname(__FILE__) + '/lorem.txt', 'r')
|
2011-01-14 11:01:02 -08:00
|
|
|
end
|
|
|
|
|
2011-10-26 11:08:48 -03:00
|
|
|
def array_differences(array_a, array_b)
|
|
|
|
(array_a - array_b) | (array_b - array_a)
|
|
|
|
end
|
|
|
|
|
2010-11-22 17:49:27 -08:00
|
|
|
# check to see which credentials are available and add others to the skipped tags list
|
2012-08-15 17:24:17 +01:00
|
|
|
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"]
|
|
|
|
|
2011-05-24 17:31:05 -07:00
|
|
|
available_providers = Fog.available_providers.map {|provider| provider.downcase}
|
2012-08-15 17:24:17 +01:00
|
|
|
|
|
|
|
unavailable_providers = all_providers - available_providers
|
|
|
|
|
|
|
|
for provider in unavailable_providers
|
2010-11-22 17:49:27 -08:00
|
|
|
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)
|
|
|
|
end
|
2012-05-28 13:06:46 -05:00
|
|
|
|
|
|
|
# mark libvirt tests pending if not setup
|
|
|
|
begin
|
|
|
|
require('ruby-libvirt')
|
|
|
|
rescue LoadError
|
2012-05-28 15:17:12 -05:00
|
|
|
Formatador.display_line("[yellow]Skipping tests for [bold]libvirt[/] [yellow]due to missing `ruby-libvirt` gem.[/]")
|
2012-05-28 13:06:46 -05:00
|
|
|
Thread.current[:tags] << '-libvirt'
|
|
|
|
end
|