From a239227d2af38d0d642233e2a4a0f6ddc1546464 Mon Sep 17 00:00:00 2001 From: Greg Blomquist Date: Fri, 15 Aug 2014 15:03:01 -0400 Subject: [PATCH] Show failure for Openstack Storate service_type The openstack_service_type for the Openstack Storage Service (Swift) currently defaults to "object-store". However, if the Swift service is unvailable, the authenticate_v2 method attempts to call: service_type.join ", " The problem is that the String "object-store" doesn't have a join method. The new tests show that "object-store" is an invalid service_type, whereas ["object-store"] is a valid service_type. https://github.com/fog/fog/issues/3112 --- tests/openstack/authenticate_tests.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/openstack/authenticate_tests.rb b/tests/openstack/authenticate_tests.rb index ed47b6b92..83a5d03a5 100644 --- a/tests/openstack/authenticate_tests.rb +++ b/tests/openstack/authenticate_tests.rb @@ -102,6 +102,26 @@ Shindo.tests('OpenStack | authenticate', ['openstack']) do end end + tests("v2 missing storage service") do + Excon.stub({ :method => 'POST', :path => "/v2.0/tokens" }, + { :status => 200, :body => Fog::JSON.encode(body) }) + + raises(NoMethodError, + "undefined method `join' for \"object-store\":String") do + Fog::OpenStack.authenticate_v2( + :openstack_auth_uri => URI('http://example/v2.0/tokens'), + :openstack_tenant => 'admin', + :openstack_service_type => 'object-store') + end + raises(Fog::Errors::NotFound, + "Could not find service object-store. Have compute, image") do + Fog::OpenStack.authenticate_v2( + :openstack_auth_uri => URI('http://example/v2.0/tokens'), + :openstack_tenant => 'admin', + :openstack_service_type => %w[object-store]) + end + end + tests("v2 auth with two compute services") do body_clone = body.clone body_clone["access"]["serviceCatalog"] <<