Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make test output more verbose if provider service is unavailable
  • Loading branch information
allomov committed Dec 26, 2013
1 parent 7880a55 commit 38c760a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Expand Up @@ -73,7 +73,7 @@ task :mock, :provider do |t, args|
fail 'USAGE: rake mock[<provider>]'
end
provider = args[:provider]
sh("export FOG_MOCK=true && bundle exec shindont tests/#{provider}")
sh("export FOG_MOCK=true PROVIDER=#{provider} && bundle exec shindont tests/#{provider}")
end

desc 'Run live tests against a specific provider'
Expand All @@ -82,7 +82,7 @@ task :live, :provider do |t, args|
fail 'USAGE: rake live[<provider>]'
end
provider = args[:provider]
sh("export FOG_MOCK=false && bundle exec shindont tests/#{provider}")
sh("export FOG_MOCK=false PROVIDER=#{provider} && bundle exec shindont tests/#{provider}")
end

task :nuke do
Expand Down
6 changes: 6 additions & 0 deletions tests/helper.rb
Expand Up @@ -39,6 +39,12 @@ def array_differences(array_a, array_b)

unavailable_providers = all_providers - available_providers

if !ENV['PROVIDER'].nil? && unavailable_providers.include?(ENV['PROVIDER'])
Formatador.display_line("[red]Requested provider #{ENV['PROVIDER']} is not available.[/]" +
"[red]Check if .fog file has correct configuration (see '#{Fog.credentials_path}')[/]")
exit(0)
end

for provider in unavailable_providers
Formatador.display_line("[yellow]Skipping tests for [bold]#{provider}[/] [yellow]due to lacking credentials (add some to '#{Fog.credentials_path}' to run them)[/]")
Thread.current[:tags] << ('-' << provider)
Expand Down

0 comments on commit 38c760a

Please sign in to comment.