Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

find_all_bindings should return handles rather than credentials

Change-Id: I9dda1e7add3fcf2805d415bd854ae9d2e259e751
  • Loading branch information...
commit 3726febeb0ad41aa2633cb188d4652295154d0a2 1 parent ec3334f
@andl andl authored
View
BIN  atmos/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
6 base/lib/base/provisioner.rb
@@ -81,7 +81,7 @@ def update_handles(handles)
def find_all_bindings(name)
res = []
@prov_svcs.each do |k,v|
- res << v[:credentials] if v[:credentials]["name"] == name && v[:service_id] != name
+ res << v if v[:credentials]["name"] == name && v[:service_id] != name
end
res
end
@@ -240,8 +240,8 @@ def unprovision_service(instance_id, &blk)
@logger.debug("[#{service_description}] Unprovisioning instance #{instance_id} from #{node_id}")
request = UnprovisionRequest.new
request.name = instance_id
- request.bindings = bindings
- @logger.debug("[#{service_description}] Sending reqeust #{request}")
+ request.bindings = bindings.map{|h| h[:credentials]}
+ @logger.debug("[#{service_description}] Sending request #{request}")
subscription = nil
timer = EM.add_timer(@node_timeout) {
@node_nats.unsubscribe(subscription)
View
3  base/spec/helper/provision_spec_helper.rb
@@ -256,10 +256,11 @@ def initialize(id, score)
}
@nats.subscribe("#{service_name}.bind.#{node_id}") { |msg, reply|
@got_bind_request = true
+ request = BindRequest.decode(msg)
response = BindResponse.new
response.success = true
response.credentials = {
- 'name' => UUIDTools::UUID.random_create.to_s,
+ 'name' => request.name,
'node_id' => node_id,
'username' => UUIDTools::UUID.random_create.to_s,
'password' => UUIDTools::UUID.random_create.to_s,
View
19 base/spec/provision_spec.rb
@@ -159,6 +159,25 @@
node.got_unprovision_request.should be_true
end
+ it "should delete instance handles in cache after unprovision" do
+ provisioner = gateway = nil
+ node = nil
+ EM.run do
+ Do.at(0) { provisioner = ProvisionerTests.create_provisioner; provisioner.prov_svcs.size.should == 0 }
+ Do.at(1) { gateway = ProvisionerTests.create_gateway(provisioner) }
+ Do.at(2) { node = ProvisionerTests.create_node(1) }
+ Do.at(3) { gateway.send_provision_request }
+ Do.at(4) { gateway.send_bind_request }
+ Do.at(5) { gateway.send_unprovision_request }
+ Do.at(6) { EM.stop }
+ end
+ node.got_provision_request.should be_true
+ node.got_bind_request.should be_true
+ node.got_unprovision_request.should be_true
+ current_cache = provisioner.prov_svcs
+ current_cache.size.should == 0
+ end
+
it "should handle error in unprovision" do
provisioner = nil
gateway = nil
View
BIN  filesystem/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  mongodb/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  mysql/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  neo4j/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  postgresql/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  rabbit/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  redis/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  service_broker/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
View
BIN  vblob/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.