Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 2 commits into from

4 participants

@hgadgil
  • git shortlog 055964f622..9267b079b1 Harshawardhan Gadgil (1): Add (optional) provider to GatewayProvisionRequest

Change-Id: I2aba012badd16bc1a81c1598f65d041e94b38da3

@hgadgil

Verified on Dev104

@cf-frontend
Collaborator

Can you please add a test to lock down information when we provision an instance.

@hgadgil

I've added a spec, but note that these fields are still in design so more fields may be added etc... The spec will need to be updated accordingly.

Further note that, the speciifc field in question in this CR is the "provider" which was added as an optional field in order to maintain backwards compatibility with CC as the vcap-common repo (where the gateway provision request) is defined is shared by CC and CCNG.

@cf-frameworks
Collaborator

Could you please rebase? I can't merge it in otherwise.

@hgadgil

Rebased... but DO NOT ACCEPT/MERGE this change until src/services has been bumped... will follow up shortly. Thanks,

@hgadgil

vcap-common bump in src/services and src/services bump in cf-release necessary to avoid service provisioning failure is already done now, so should be OK to approve/merge this change.

@cf-frontend
Collaborator

one more little change - include user_guid in min_expected_fields_in_gw_provision_request

@hgadgil

I purposefully did not include user_guid field in spec because, we might end up removing user_guid in near future so don't want to lock this field in spec.

Harshawardha... added some commits
Harshawardhan Gadgil Send provider in gateway provision request (with bump to vcap-common)
 - git shortlog 055964f622..9267b079b1
    Harshawardhan Gadgil (1):
      Add (optional) provider to GatewayProvisionRequest

Change-Id: I2aba012badd16bc1a81c1598f65d041e94b38da3
6aea65e
Harshawardhan Gadgil Add spec to ensure basic information in GW provision request
Change-Id: I6c6b0de40e87132aec2f240b2e435b6b2e1c91ef
9a0caba
@hgadgil

Spec fixed

@kushmerick kushmerick merged commit fc28aa8 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 1, 2013
  1. Send provider in gateway provision request (with bump to vcap-common)

    Harshawardhan Gadgil authored
     - git shortlog 055964f622..9267b079b1
        Harshawardhan Gadgil (1):
          Add (optional) provider to GatewayProvisionRequest
    
    Change-Id: I2aba012badd16bc1a81c1598f65d041e94b38da3
  2. Add spec to ensure basic information in GW provision request

    Harshawardhan Gadgil authored
    Change-Id: I6c6b0de40e87132aec2f240b2e435b6b2e1c91ef
This page is out of date. Refresh to see the latest.
View
2  Gemfile
@@ -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"
View
4 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)
View
5 lib/cloud_controller/models/service_instance.rb
@@ -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}"
View
30 spec/models/service_instance_spec.rb
@@ -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(
@@ -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
Something went wrong with that request. Please try again.