Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

don't assume service acls are set

Change-Id: I533adf6d52999749747d31127b546aaa40e25b43
Reviewed-on: http://reviews.cloudfoundry.org/10041
Tested-by: CI Master <cf-ci@rbcon.com>
Reviewed-by: Pin Xie <pxie@vmware.com>
  • Loading branch information...
commit 939ac00ed161200c50805493273415b446102fa9 1 parent 5686924
@kushmerick kushmerick authored
Showing with 43 additions and 33 deletions.
  1. +43 −33 spec/users/acl_spec.rb
View
76 spec/users/acl_spec.rb
@@ -29,14 +29,18 @@ def verify_get_service_plan
service_name = manifest[:vendor]
plans = sys_services[service_name][:plans]
service_gateway = manifest[:vendor].gsub('rabbitmq', 'rabbit') + "_gateway"
- plan_list = DEPLOY_MANIFEST[service_gateway]['acls']['plans'].keys
- plan_list.each do |plan|
- acl_wildcards = DEPLOY_MANIFEST[service_gateway]['acls']['plans'][plan]['wildcards']
- acl_email = get_acl_email(acl_wildcards)
- if @session.email.match(/@(#{acl_email})\.com$/)
- plans.include?(plan).should == true
- else
- plans.include?(plan).should == false
+ acls = DEPLOY_MANIFEST[service_gateway]['acls']
+ if acls && acls['plans']
+ acls['plans'].each do |plan,plan_acls|
+ acl_wildcards = plan_acls['wildcards']
+ if acl_wildcards
+ acl_email = get_acl_email(acl_wildcards)
+ if @session.email.match(/@(#{acl_email})\.com$/)
+ plans.include?(plan).should == true
+ else
+ plans.include?(plan).should == false
+ end
+ end
end
end
end
@@ -46,22 +50,24 @@ def verify_create_service
SERVICE_MANIFEST_LIST.each do |manifest|
service_name = manifest[:vendor]
service_gateway = manifest[:vendor].gsub('rabbitmq', 'rabbit') + "_gateway"
- plan_list = DEPLOY_MANIFEST[service_gateway]['acls']['plans'].keys
- plan_list.each do |plan|
- acl_wildcards = DEPLOY_MANIFEST[service_gateway]['acls']['plans'][plan]['wildcards']
- acl_email = get_acl_email(acl_wildcards)
- ENV['VCAP_BVT_SERVICE_PLAN'] = plan
- service = @session.service(service_name, false)
- e1 = nil
- begin
- service.create(manifest)
- rescue => e
- e1 = e.to_s
- end
- if @session.email.match(/@(#{acl_email})\.com$/)
- e1.should == nil
- else
- e1.should =~ /404: entity not found or inaccessible/
+ acls = DEPLOY_MANIFEST[service_gateway]['acls']
+ if acls && acls['plans']
+ acls['plans'].each do |plan,plan_acls|
+ acl_wildcards = plan_acls['wildcards']
+ acl_email = get_acl_email(acl_wildcards)
+ ENV['VCAP_BVT_SERVICE_PLAN'] = plan
+ service = @session.service(service_name, false)
+ e1 = nil
+ begin
+ service.create(manifest)
+ rescue => e
+ e1 = e.to_s
+ end
+ if @session.email.match(/@(#{acl_email})\.com$/)
+ e1.should == nil
+ else
+ e1.should =~ /404: entity not found or inaccessible/
+ end
end
end
end
@@ -89,15 +95,19 @@ def get_acl_email(email_list)
it "acl: blob service visibility" do
vblob_service = @session.system_services['blob']
- plan_list = DEPLOY_MANIFEST['vblob_gateway']['acls']['plans'].keys
- plan_list.each do |plan|
- acl_wildcards = DEPLOY_MANIFEST['vblob_gateway']['acls']['plans'][plan]['wildcards']
- acl_email = get_acl_email(acl_wildcards)
- if @session.email.match(/@(#{acl_email})\.com$/)
- vblob_service.should_not == nil
- vblob_service[:versions].should_not == nil
- else
- vblob_service.should == nil
+ acls = DEPLOY_MANIFEST['vblob_gateway']['acls']
+ if acls && acls['plans']
+ acls['plans'].each do |plan,plan_acls|
+ acl_wildcards = plan_acls['wildcards']
+ if acl_wildcards
+ acl_email = get_acl_email(acl_wildcards)
+ if @session.email.match(/@(#{acl_email})\.com$/)
+ vblob_service.should_not == nil
+ vblob_service[:versions].should_not == nil
+ else
+ vblob_service.should == nil
+ end
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.