1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/tasks/test_task.rb
Nelvin Driz 64da603d09 [openstack] Fix Test
There seems to be a difference in results coming from these two:

export FOG_MOCK=true && bundle exec shindont +openstack
FOG_MOCK=true shindo tests/openstack/requests/compute/security_group_tests.rb

Signed-off-by: Nelvin Driz <nelvindriz@live.com>
2012-12-05 14:45:37 +08:00

46 lines
1.1 KiB
Ruby

require "rake"
require "rake/tasklib"
module Fog
module Rake
class TestTask < ::Rake::TaskLib
def initialize
desc "Run the mocked tests"
task :test do
::Rake::Task[:mock_tests].invoke
end
task :mock_tests do
tests(true)
end
task :real_tests do
tests(false)
end
end
def tests(mocked)
Formatador.display_line
start = Time.now.to_i
threads = []
Thread.main[:results] = []
Fog.providers.each do |key, value|
threads << Thread.new do
Thread.main[:results] << {
:provider => value,
:success => sh("export FOG_MOCK=#{mocked} && bundle exec shindont +#{key}")
}
end
end
threads.each do |thread|
thread.join
end
Formatador.display_table(Thread.main[:results].sort {|x,y| x[:provider] <=> y[:provider]})
Formatador.display_line("[bold]FOG_MOCK=#{mocked}[/] tests completed in [bold]#{Time.now.to_i - start}[/] seconds")
Formatador.display_line
end
end
end
end