Permalink
Browse files

[cfruntime-tests] Support v1 and v2 [#45254975]

  • Loading branch information...
1 parent 5bc5b89 commit 046dbdf4507bee2ef6a31fb7a534a8b903b7d28d Bleicke and Maria Shaldibina committed Mar 7, 2013
Showing with 9 additions and 5 deletions.
  1. +9 −5 cfruntime-tests/spec/spec_helper.rb
@@ -90,8 +90,8 @@ def create_app(framework='sinatra', runtime='ruby18', instances=1, memory=256)
@app.memory = memory
unless v2?
- @app.framework = framework
- @app.runtime = runtime
+ @app.framework = @client.framework_by_name(framework)
+ @app.runtime = @client.runtime_by_name(runtime)
end
@app.create!
@@ -177,11 +177,14 @@ def provision_service(service_type, prefix)
return unless service_available?(service_type)
service_instance = @client.service_instance
service_instance.name = "#{prefix}-#{app_name}-#{SERVICE_NAMES[service_type]}"
+ system_service = system_service(service_type)
if v2?
service_instance.space = @client.current_space
- service_instance.service_plan = system_service(service_type).service_plans.first
+ service_instance.service_plan = system_service.service_plans.first
else
- service_instance.vendor = service_type
+ service_instance.vendor = system_service.label
+ service_instance.tier = "free"
+ service_instance.version = system_service.version
end
service_instance.create!
attach_provisioned_service(service_instance)
@@ -264,7 +267,8 @@ def attach_provisioned_service(service_instance)
end
def delete_services
- @client.current_space.service_instances.each do |service|
+ services = v2? ? @client.current_space.service_instances : @client.service_instances
+ services.each do |service|
service.delete!
end
rescue CFoundry::NotFound

0 comments on commit 046dbdf

Please sign in to comment.