Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send provider in gateway provision request (with bump to vcap-common) #2

Merged
merged 2 commits into from Feb 1, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -12,7 +12,7 @@ gem "sinatra-contrib"
gem "yajl-ruby"
gem 'vcap-concurrency', :git => 'git://github.com/cloudfoundry/vcap-concurrency.git'
gem "membrane", "~> 0.0.2"
gem "vcap_common", "~> 2.0.8", :git => 'git://github.com/cloudfoundry/vcap-common.git', :ref => '055964f622'
gem "vcap_common", "~> 2.0.8", :git => 'git://github.com/cloudfoundry/vcap-common.git', :ref => '9267b079b1'
gem "cf-uaa-lib", "~> 1.3.0"
gem "httpclient"
gem "steno", "~> 1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
@@ -1,7 +1,7 @@
GIT
remote: git://github.com/cloudfoundry/vcap-common.git
revision: 055964f62282c94ebe7c3ce6f4df9fb093a17714
ref: 055964f622
revision: 9267b079b1179360dc0356c5dbd0ff9b772f663d
ref: 9267b079b1
specs:
vcap_common (2.0.10)
em-http-request (~> 1.0.0.beta3, < 1.0.0.beta4)
Expand Down
5 changes: 2 additions & 3 deletions lib/cloud_controller/models/service_instance.rb
Expand Up @@ -175,9 +175,8 @@ def provision_on_gateway
:plan => service_plan.name,
:plan_option => {}, # TODO: remove this
:version => service_plan.service.version,
# The current version of the service gateways that are in cf-release don't
# support this. It makes them fail json validation of the message.
# :user_guid => VCAP::CloudController::SecurityContext.current_user_guid
:provider => service_plan.service.provider,
:user_guid => VCAP::CloudController::SecurityContext.current_user_guid
)

logger.debug "provision response for instance #{guid} #{gw_attrs.inspect}"
Expand Down
30 changes: 28 additions & 2 deletions spec/models/service_instance_spec.rb
Expand Up @@ -37,9 +37,13 @@ module VCAP::CloudController
let(:gw_client) { double(:client) }

let(:token) { Models::ServiceAuthToken.make }

let(:service) { Models::Service.make(:label => token.label,
:provider => token.provider) }
let(:service_plan) { Models::ServicePlan.make(:service => service) }
:provider => token.provider,
:version => "1.0") }

let(:service_plan) { Models::ServicePlan.make(:service => service,
:name => "myplan") }

let(:provision_resp) do
VCAP::Services::Api::GatewayHandleResponse.new(
Expand Down Expand Up @@ -90,6 +94,28 @@ module VCAP::CloudController
end
}.should raise_error
end

it "ensure gateway provision request contains specific fields" do
VCAP::CloudController::SecurityContext.
should_receive(:current_user_email).
and_return("a@b.c")

min_expected_fields_in_gw_provision_request = {
:label => "#{token.label}-#{service.version}",
:name => "foobar",
:email => "a@b.c",
:plan => "myplan",
:version => "1.0",
:user_guid => nil,
:provider => token.provider,
}

gw_client.should_receive(:provision).
with(hash_including(min_expected_fields_in_gw_provision_request)).
and_return(provision_resp)

instance = Models::ServiceInstance.make(:name => "foobar", :service_plan => service_plan)
end
end

context "service deprovisioning" do
Expand Down