Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert 'Revert "remove framework/runtime"'

This reverts commit f5a7698.
  • Loading branch information...
commit ba8a4626ed37e4af3a3f2a4f7782400be27b47c3 1 parent f5a7698
Alex Suraci & Bleicke authored
Showing with 63 additions and 955 deletions.
  1. +0 −2  bin/document_api
  2. +0 −10 config/frameworks/myframework.yml
  3. +0 −9 config/frameworks/node.yml
  4. +0 −18 config/frameworks/sinatra.yml
  5. +0 −9 config/frameworks/spring.yml
  6. +0 −23 config/frameworks/standalone.yml
  7. +0 −41 config/runtimes.yml
  8. +13 −0 db/migrations/20130323005501_remove_framework_and_runtime.rb
  9. +1 −3 lib/cloud_controller/api/app.rb
  10. +0 −2  lib/cloud_controller/api/app_summary.rb
  11. +0 −28 lib/cloud_controller/api/framework.rb
  12. +0 −31 lib/cloud_controller/api/runtime.rb
  13. +0 −2  lib/cloud_controller/api/space_summary.rb
  14. +0 −7 lib/cloud_controller/app_stager.rb
  15. +0 −2  lib/cloud_controller/config.rb
  16. +1 −6 lib/cloud_controller/dea/dea_client.rb
  17. +4 −9 lib/cloud_controller/dea/dea_pool.rb
  18. +0 −29 lib/cloud_controller/legacy_api/legacy_apps.rb
  19. +0 −4 lib/cloud_controller/legacy_api/legacy_bulk.rb
  20. +1 −50 lib/cloud_controller/legacy_api/legacy_info.rb
  21. +0 −2  lib/cloud_controller/models.rb
  22. +6 −21 lib/cloud_controller/models/app.rb
  23. +0 −43 lib/cloud_controller/models/framework.rb
  24. +0 −43 lib/cloud_controller/models/runtime.rb
  25. +1 −23 lib/cloud_controller/runner.rb
  26. +0 −18 manifest.yml
  27. +8 −50 spec/api/app_spec.rb
  28. +0 −10 spec/api/app_summary_spec.rb
  29. +0 −54 spec/api/framework_spec.rb
  30. +4 −158 spec/api/legacy_apps_spec.rb
  31. +2 −3 spec/api/legacy_bulk_spec.rb
  32. +0 −28 spec/api/legacy_info_spec.rb
  33. +0 −34 spec/api/runtime_spec.rb
  34. +1 −3 spec/api/space_summary_spec.rb
  35. +0 −3  spec/app_stager_spec.rb
  36. +0 −10 spec/config_spec.rb
  37. +0 −2  spec/dea/dea_client_spec.rb
  38. +13 −63 spec/dea/dea_pool_spec.rb
  39. +1 −9 spec/models/app_spec.rb
  40. +0 −36 spec/models/framework_spec.rb
  41. +0 −36 spec/models/runtime_spec.rb
  42. +7 −7 spec/stager_pool_spec.rb
  43. +0 −14 spec/support/fakes/blueprints.rb
View
2  bin/document_api
@@ -20,8 +20,6 @@ module Docs
VCAP::CloudController::User,
VCAP::CloudController::Space,
VCAP::CloudController::App,
- VCAP::CloudController::Runtime,
- VCAP::CloudController::Framework,
VCAP::CloudController::Service,
VCAP::CloudController::ServicePlan,
VCAP::CloudController::ServiceInstance,
View
10 config/frameworks/myframework.yml
@@ -1,10 +0,0 @@
----
-name: "myframework"
-runtimes:
- - node:
- default: true
- - node06:
- default: false
-detection:
- - "*.js": '.'
-disabled: true
View
9 config/frameworks/node.yml
@@ -1,9 +0,0 @@
----
-name: "node"
-runtimes:
- - node:
- default: true
- - node06:
- default: false
-detection:
- - "*.js": '.'
View
18 config/frameworks/sinatra.yml
@@ -1,18 +0,0 @@
----
-name: "sinatra"
-runtimes:
- - ruby18:
- default: true
- environment:
- bundle_gemfile:
- - ruby19:
- environment:
- bundle_gemfile:
- - myruntime:
- default: false
-detection:
- - "*.rb": "require\\s+'sinatra'|require\\s+\"sinatra\"" # .rb files in the root dir containing a require?
- - "config.ru": false # use rack if it detects a config.ru
- - "config/environment.rb": false # and config/environment.rb must not exist
-
-# vim: filetype=yaml
View
9 config/frameworks/spring.yml
@@ -1,9 +0,0 @@
----
-name: "spring"
-runtimes:
- - "java":
- default: true
-detection:
- - "*.war": true # TODO - this thinks everything with an XML file is Spring
-
-# vim: filetype=yaml
View
23 config/frameworks/standalone.yml
@@ -1,23 +0,0 @@
----
-name: "standalone"
-runtimes:
- - python2:
- default: false
- - java:
- default: false
- - node:
- default: false
- - node06:
- default: false
- - erlangR14B02:
- default: false
- - php:
- default: false
- - ruby18:
- environment:
- bundle_gemfile:
- - ruby19:
- environment:
- bundle_gemfile:
-
-# vim: filetype=yaml
View
41 config/runtimes.yml
@@ -1,41 +0,0 @@
----
-python2:
- version: "2.6.5"
- description: "Python 2.6.5"
- executable: python
-java:
- description: "Java 6"
- version: "1.6"
- executable: "java"
-node:
- version: "0.4.12"
- description: "Node.js"
- executable: node
-node06:
- version: "0.6.8"
- description: "Node.js"
- executable: node
-erlangR14B02:
- version: "R14B02"
- description: "Erlang R14B02"
- executable: /var/vcap/runtimes/erlang-R14B02/bin/erl
-php:
- description: "PHP 5"
- version: "5.3"
- executable: "php"
-ruby18:
- version: "1.8.7"
- description: "Ruby 1.8.7"
- executable: "/usr/bin/ruby"
- bundler: "bundle"
- environment:
- bundle_gemfile:
-ruby19:
- version: "1.9.2"
- description: "Ruby 1.9.2"
- executable: "ruby"
- bundler: "bundle"
-myruntime:
- version: "1.0"
- description: "My Runtime"
- disabled: true
View
13 db/migrations/20130323005501_remove_framework_and_runtime.rb
@@ -0,0 +1,13 @@
+# Copyright (c) 2009-2012 VMware, Inc.
+
+Sequel.migration do
+ change do
+ alter_table :apps do
+ drop_column :framework_id
+ drop_column :runtime_id
+ end
+
+ drop_table :frameworks
+ drop_table :runtimes
+ end
+end
View
4 lib/cloud_controller/api/app.rb
@@ -15,8 +15,6 @@ module VCAP::CloudController
attribute :production, Message::Boolean, :default => false
to_one :space
- to_one :runtime, :optional_in => :create
- to_one :framework, :optional_in => :create
to_one :stack, :optional_in => :create
attribute :environment_json, Hash, :default => {}
@@ -37,7 +35,7 @@ module VCAP::CloudController
to_many :routes
end
- query_parameters :name, :space_guid, :organization_guid, :framework_guid, :runtime_guid
+ query_parameters :name, :space_guid, :organization_guid
def self.translate_validation_exception(e, attributes)
space_and_name_errors = e.errors.on([:space_id, :name])
View
2  lib/cloud_controller/api/app_summary.rb
@@ -20,8 +20,6 @@ def summary(id)
:guid => app.guid,
:name => app.name,
:routes => app.routes.map(&:as_summary_json),
- :framework => app.framework.to_hash.merge(:guid => app.framework.guid),
- :runtime => app.runtime.to_hash.merge(:guid => app.runtime.guid),
:running_instances => app.running_instances,
:services => app.service_instances.map(&:as_summary_json),
:available_domains => app.space.domains.map(&:as_summary_json)
View
28 lib/cloud_controller/api/framework.rb
@@ -1,28 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-module VCAP::CloudController
- rest_controller :Framework do
- permissions_required do
- full Permissions::CFAdmin
- read Permissions::Authenticated
- end
-
- define_attributes do
- attribute :name, String
- attribute :description, String
- attribute :internal_info, Hash
- to_many :apps
- end
-
- query_parameters :name, :app_guid
-
- def self.translate_validation_exception(e, attributes)
- name_errors = e.errors.on(:name)
- if name_errors && name_errors.include?(:unique)
- Errors::FrameworkNameTaken.new(attributes["name"])
- else
- Errors::FrameworkInvalid.new(e.errors.full_messages)
- end
- end
- end
-end
View
31 lib/cloud_controller/api/runtime.rb
@@ -1,31 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-module VCAP::CloudController
- rest_controller :Runtime do
- permissions_required do
- full Permissions::CFAdmin
- read Permissions::Authenticated
- end
-
- define_attributes do
- attribute :name, String
- attribute :description, String
- attribute :internal_info, Hash
-
- # version was really a v1 concept, but the yeti tests expect it
- attribute :version, String, :exclude_in => [:create, :update]
- to_many :apps, :default => []
- end
-
- query_parameters :name, :app_guid
-
- def self.translate_validation_exception(e, attributes)
- name_errors = e.errors.on(:name)
- if name_errors && name_errors.include?(:unique)
- Errors::RuntimeNameTaken.new(attributes["name"])
- else
- Errors::RuntimeInvalid.new(e.errors.full_messages)
- end
- end
- end
-end
View
2  lib/cloud_controller/api/space_summary.rb
@@ -49,8 +49,6 @@ def app_summary(app)
:urls => app.routes.map(&:fqdn),
:routes => app.routes.map(&:as_summary_json),
:service_count => app.service_bindings_dataset.count,
- :framework => { :name => app.framework.name },
- :runtime => { :name => app.runtime.name },
:running_instances => 0,
}.merge(app.to_hash)
end
View
7 lib/cloud_controller/app_stager.rb
@@ -195,13 +195,6 @@ def destroy_upload_handle
def staging_task_properties(app)
{
:services => app.service_bindings.map { |sb| service_binding_to_staging_request(sb) },
- :framework => app.framework.name,
- :framework_info => app.framework.internal_info,
-
- :runtime => app.runtime.name,
- :runtime_info => app.runtime.internal_info.merge(
- :name => app.runtime.name
- ),
:buildpack => app.buildpack,
View
2  lib/cloud_controller/config.rb
@@ -46,7 +46,6 @@ class VCAP::CloudController::Config < VCAP::Config
optional(:staging_manifests) => String,
},
- optional(:runtimes_file) => String,
optional(:stacks_file) => String,
:db => {
@@ -168,7 +167,6 @@ def self.config_dir
private
def self.merge_defaults(config)
- config[:runtimes_file] ||= File.join(config_dir, "runtimes.yml")
config[:stacks_file] ||= File.join(config_dir, "stacks.yml")
config[:directories] ||= {}
View
7 lib/cloud_controller/dea/dea_client.rb
@@ -225,7 +225,7 @@ def start_instances_with_message(app, indices, message_override)
indices.each do |idx|
msg[:index] = idx
- dea_id = dea_pool.find_dea(app.memory, app.runtime.name, app.stack.name)
+ dea_id = dea_pool.find_dea(app.memory, app.stack.name)
if dea_id
dea_publish("#{dea_id}.start", msg.merge(message_override))
else
@@ -313,11 +313,6 @@ def start_app_message(app)
:droplet => app.guid,
:name => app.name,
:uris => app.uris,
- :runtime => app.runtime.name,
- :runtime_info => app.runtime.internal_info.merge(
- :name => app.runtime.name
- ),
- :framework => app.framework.name,
:prod => app.production,
:sha1 => app.droplet_hash,
:executableFile => "deprecated",
View
13 lib/cloud_controller/dea/dea_pool.rb
@@ -29,13 +29,13 @@ def process_advertise_message(msg)
end
end
- def find_dea(mem, runtime, stack)
+ def find_dea(mem, stack)
mutex.synchronize do
@deas.keys.shuffle.each do |id|
dea = @deas[id]
if dea_expired?(dea)
@deas.delete(id)
- elsif dea_meets_needs?(dea, mem, runtime, stack)
+ elsif dea_meets_needs?(dea, mem, stack)
return id
end
end
@@ -49,17 +49,12 @@ def dea_expired?(dea)
(Time.now.to_i - dea[:last_update].to_i) > ADVERTISEMENT_EXPIRATION
end
- def dea_meets_needs?(dea, mem, runtime, stack)
+ def dea_meets_needs?(dea, mem, stack)
stats = dea[:advertisement]
- has_runtime = stats[:runtimes].nil? || stats[:runtimes].include?(runtime)
has_stack = stats[:stacks].include?(stack)
- if stats[:available_memory] >= mem
- has_runtime && has_stack
- else
- false
- end
+ (stats[:available_memory] >= mem) && has_stack
end
def mutex
View
29 lib/cloud_controller/legacy_api/legacy_apps.rb
@@ -129,10 +129,6 @@ def instances(name)
def legacy_app_encoding(app)
{
:name => app.name,
- :staging => {
- :model => app.framework.name,
- :stack => app.runtime.name,
- },
:uris => app.uris,
:instances => app.instances,
:runningInstances => app.running_instances,
@@ -215,21 +211,6 @@ def translate_legacy_create_json(hash)
end
if staging = hash["staging"]
- framework = nil
- if framework_name = staging["framework"] || staging["model"]
- framework = Models::Framework.find(:name => framework_name)
- raise FrameworkInvalid.new(framework_name) unless framework
- req[:framework_guid] = framework.guid
- end
-
- runtime_name = staging["runtime"] || staging["stack"]
- runtime_name ||= default_runtime_for_framework(framework)
- if runtime_name
- runtime = Models::Runtime.find(:name => runtime_name)
- raise RuntimeInvalid.new(runtime_name) unless runtime
- req[:runtime_guid] = runtime.guid
- end
-
req[:command] = staging["command"] if staging["command"]
end
@@ -292,16 +273,6 @@ def around_translate(old_json, &translate)
Yajl::Encoder.encode(translated)
end
- def default_runtime_for_framework(framework)
- return unless framework
- framework.internal_info["runtimes"].each do |runtime|
- runtime.each do |runtime_name, runtime_info|
- return runtime_name if runtime_info["default"] == true
- end
- end
- nil
- end
-
def self.setup_routes
get "/apps", :enumerate
post "/apps", :create
View
4 lib/cloud_controller/legacy_api/legacy_bulk.rb
@@ -10,8 +10,6 @@ class BulkResponse < JsonMessage
{
"id" => String,
"instances" => Integer,
- "framework" => String,
- "runtime" => String,
# FIXME: find the enum for this
"state" => String,
"memory" => Integer,
@@ -96,8 +94,6 @@ def bulk_apps
end
hash["id"] = app.guid
hash["updated_at"] = app.updated_at || app.created_at
- hash["runtime"] = app.runtime.name
- hash["framework"] = app.framework.name
apps[app.guid] = hash
id_for_next_token = app.id
end
View
51 lib/cloud_controller/legacy_api/legacy_info.rb
@@ -15,9 +15,7 @@ def info
:description => config[:info][:description],
:authorization_endpoint => config[:login] ? config[:login][:url] : config[:uaa][:url],
:token_endpoint => config[:uaa][:url],
- :allow_debug => config[:allow_debug] || true,
- # TODO get this from DB
- :frameworks => legacy_framework_info
+ :allow_debug => config[:allow_debug] || true
}
# If there is a logged in user, give out additional information
@@ -25,7 +23,6 @@ def info
info[:user] = user.guid
info[:limits] = account_capacity
info[:usage] = account_usage if has_default_space?
- info[:frameworks] = legacy_framework_info
end
Yajl::Encoder.encode(info)
@@ -48,18 +45,6 @@ def service_info
Yajl::Encoder.encode(legacy_resp)
end
- def runtime_info
- rt_info = Models::Runtime.all.inject({}) do |result, runtime|
- result.merge(runtime.name => {
- :version => runtime.internal_info["version"],
- :description => runtime.description,
- :debug_modes=> runtime.internal_info["debug_modes"],
- })
- end
-
- Yajl::Encoder.encode(rt_info)
- end
-
private
def account_capacity
@@ -108,42 +93,8 @@ def legacy_svc_encoding(svc)
}
end
- # this is a direct port of the legacy cc info.
- def legacy_framework_info
- frameworks_info = {}
- Models::Framework.each do |framework|
- runtimes = []
-
- framework.internal_info["runtimes"].each do |runtime|
- runtime.keys.each do |runtime_name|
- runtime = Models::Runtime[:name => runtime_name]
- if runtime
- runtimes << {
- :name => runtime_name,
- :description => runtime.description,
- :version => runtime.internal_info["version"],
- }
- else
- logger.warn(
- "Manifest for #{framework.name} lists a runtime not " +
- "present in runtimes.yml: #{runtime_name}. " +
- "Runtime will be skipped."
- )
- end
- end
- end
- frameworks_info[framework.name] = {
- :name => framework.name,
- :runtimes => runtimes,
- :detection => framework.internal_info["detection"],
- }
- end
- frameworks_info
- end
-
def self.setup_routes
get "/info", :info
- get "/info/runtimes", :runtime_info
get "/info/services", :service_info
end
View
2  lib/cloud_controller/models.rb
@@ -84,10 +84,8 @@ class InvalidRelation < StandardError; end
require "cloud_controller/models/app"
require "cloud_controller/models/domain"
-require "cloud_controller/models/framework"
require "cloud_controller/models/organization"
require "cloud_controller/models/route"
-require "cloud_controller/models/runtime"
require "cloud_controller/models/service"
require "cloud_controller/models/service_auth_token"
require "cloud_controller/models/service_binding"
View
27 lib/cloud_controller/models/app.rb
@@ -11,8 +11,6 @@ class InvalidRouteRelation < InvalidRelation; end
class InvalidBindingRelation < InvalidRelation; end
many_to_one :space
- many_to_one :framework
- many_to_one :runtime
many_to_one :stack
many_to_many :routes,
:before_add => :validate_route,
@@ -26,17 +24,14 @@ class InvalidBindingRelation < InvalidRelation; end
default_order_by :name
export_attributes :name, :production,
- :space_guid, :framework_guid, :runtime_guid,
- :stack_guid, :buildpack,
- :environment_json, :memory, :instances,
- :disk_quota, :state, :version, :command, :console, :debug
+ :space_guid, :stack_guid, :buildpack,
+ :environment_json, :memory, :instances, :disk_quota,
+ :state, :version, :command, :console, :debug
import_attributes :name, :production,
- :space_guid, :framework_guid, :runtime_guid,
- :stack_guid, :buildpack,
- :environment_json, :memory, :instances,
- :disk_quota, :state,
- :command, :console, :debug,
+ :space_guid, :stack_guid, :buildpack,
+ :environment_json, :memory, :instances, :disk_quota,
+ :state, :command, :console, :debug,
:service_binding_guids, :route_guids
strip_attributes :name
@@ -55,21 +50,11 @@ class InvalidBindingRelation < InvalidRelation; end
# Last staging response which might contain streaming log url
attr_accessor :last_stager_response
- def before_validation
- # TODO: Once VMC deprecates frameworks
- # and runtimes we can remove frameworks and runtimes completely from cc.
- self.framework ||= Framework.find(:name => "buildpack")
- self.runtime ||= Runtime.find(:name => "ruby19")
- super
- end
-
def validate
validates_presence :name
validates_presence :space
validates_unique [:space_id, :name]
- validates_presence :framework
- validates_presence :runtime
validates_git_url :buildpack
validates_includes PackageStates, :package_state, :allow_missing => true
View
43 lib/cloud_controller/models/framework.rb
@@ -1,43 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-module VCAP::CloudController::Models
- class Framework < Sequel::Model
- plugin :serialization
-
- one_to_many :apps
-
- default_order_by :name
- export_attributes :name, :description, :internal_info
- import_attributes :name, :description, :internal_info
-
- strip_attributes :name
-
- serialize_attributes :json, :internal_info
-
- def validate
- validates_presence :name
- validates_presence :description
- validates_presence :internal_info
- validates_unique :name
- end
-
- def self.populate_from_directory(dir_name)
- Dir[File.join(dir_name, "*.yml")].each do |file_name|
- populate_from_file file_name
- end
- end
-
- def self.populate_from_file(file_name)
- populate_from_hash YAML.load_file(file_name)
- end
-
- def self.populate_from_hash(config)
- Framework.update_or_create(:name => config["name"]) do |r|
- r.update(
- :description => config["name"],
- :internal_info => config
- )
- end
- end
- end
-end
View
43 lib/cloud_controller/models/runtime.rb
@@ -1,43 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-module VCAP::CloudController::Models
- class Runtime < Sequel::Model
- plugin :serialization
-
- one_to_many :apps
-
- default_order_by :name
- export_attributes :name, :description, :version, :internal_info
- import_attributes :name, :description, :internal_info
-
- strip_attributes :name
-
- serialize_attributes :json, :internal_info
-
- def validate
- validates_presence :name
- validates_presence :description
- validates_presence :internal_info
- validates_unique :name
- end
-
- def version
- internal_info["version"] if internal_info
- end
-
- def self.populate_from_file(file_name)
- populate_from_hash YAML.load_file(file_name)
- end
-
- def self.populate_from_hash(config)
- config.each do |key, rt|
- Runtime.update_or_create(:name => key) do |r|
- r.update(
- :description => rt["description"],
- :internal_info => rt
- )
- end
- end
- end
- end
-end
View
24 lib/cloud_controller/runner.rb
@@ -90,7 +90,6 @@ def run!
config = @config.dup
if run_migrations
- populate_framework_and_runtimes
VCAP::CloudController::Models::QuotaDefinition.populate_from_config(config)
VCAP::CloudController::Models::Stack.populate
end
@@ -114,11 +113,6 @@ def trap_signals
end
end
- # http://tinyurl.com/bml8nzf
- def running_in_cf?
- ENV.has_key?("VCAP_APP_PORT")
- end
-
def merge_vcap_config
services = JSON.parse(ENV["VCAP_SERVICES"])
pg_key = services.keys.select { |svc| svc =~ /postgres/i }.first
@@ -130,29 +124,13 @@ def merge_vcap_config
private
def start_cloud_controller
- if running_in_cf?
- merge_vcap_config
- else
- create_pidfile
- end
+ create_pidfile
setup_logging
setup_db
@config[:bind_address] = VCAP.local_ip(@config[:local_route])
VCAP::CloudController::Config.configure(@config)
-
- logger.info "running on #{ENV["VCAP_APP_HOST"]}" if running_in_cf?
- end
-
- # This isn't exactly the best place for this, but it is also temporary. A
- # seperate utility will get written for this
- def populate_framework_and_runtimes
- rt_file = @config[:runtimes_file]
- Models::Runtime.populate_from_file(rt_file)
-
- fw_dir = @config[:directories][:staging_manifests]
- Models::Framework.populate_from_directory(fw_dir)
end
def create_app(config)
View
18 manifest.yml
@@ -1,18 +0,0 @@
----
-applications:
- .:
- name: ccng
- framework:
- name: standalone
- info:
- mem: 64M
- description: Standalone Application
- exec:
- runtime: ruby19
- command: bin/cloud_controller -m
- url: ${name}.${target-base}
- mem: 128M
- instances: 1
- services:
- postgresql-1a0bb:
- type: postgresql
View
58 spec/api/app_spec.rb
@@ -11,14 +11,12 @@ module VCAP::CloudController
it_behaves_like "a CloudController API", {
:path => "/v2/apps",
:model => Models::App,
- :basic_attributes => [:name, :space_guid, :runtime_guid, :framework_guid, :stack_guid],
- :required_attributes => [:name, :space_guid, :runtime_guid, :framework_guid],
+ :basic_attributes => [:name, :space_guid, :stack_guid],
+ :required_attributes => [:name, :space_guid],
:unique_attributes => [:name, :space_guid],
:queryable_attributes => :name,
:many_to_one_collection_ids => {
:space => lambda { |app| Models::Space.make },
- :framework => lambda { |app| Models::Framework.make },
- :runtime => lambda { |app| Models::Runtime.make },
:stack => lambda { |app| Models::Stack.make },
},
:many_to_many_collection_ids => {
@@ -51,13 +49,9 @@ module VCAP::CloudController
describe "create app" do
let(:space_guid) { Models::Space.make.guid.to_s }
- let(:framework_guid) { Models::Framework.make.guid }
- let(:runtime_guid) { Models::Runtime.make.guid }
let(:initial_hash) do
{ :name => "maria",
- :space_guid => space_guid,
- :framework_guid => framework_guid,
- :runtime_guid => runtime_guid
+ :space_guid => space_guid
}
end
@@ -65,19 +59,17 @@ module VCAP::CloudController
subject { post "/v2/apps", Yajl::Encoder.encode(initial_hash), json_headers(admin_headers) }
- context "when name, space, framework and runtime were provided" do
+ context "when name and space provided" do
it "responds with new app data" do
subject
last_response.status.should == 201
decoded_response["entity"]["name"].should == "maria"
decoded_response["entity"]["space_guid"].should == space_guid
- decoded_response["entity"]["framework_guid"].should == framework_guid
- decoded_response["entity"]["runtime_guid"].should == runtime_guid
end
end
context "when name is not provided" do
- let(:initial_hash) {{ :space_guid => space_guid, :framework_guid => framework_guid, :runtime_guid => runtime_guid }}
+ let(:initial_hash) {{ :space_guid => space_guid }}
it "responds with missing field name error" do
subject
last_response.status.should == 400
@@ -86,43 +78,13 @@ module VCAP::CloudController
end
context "when space is not provided" do
- let(:initial_hash) {{ :name => "maria", :framework_guid => framework_guid, :runtime_guid => runtime_guid }}
+ let(:initial_hash) {{ :name => "maria" }}
it "responds with missing field space error" do
subject
last_response.status.should == 400
last_response.body.should match /Error: Missing field space/
end
end
-
- context "when framework is not provided" do
- let(:initial_hash) {{ :name => "maria", :space_guid => space_guid, :runtime_guid => runtime_guid }}
- let(:buildpack_framework) { Models::Framework.make }
-
- before do
- VCAP::CloudController::Models::Framework.stub(:find).with({:name => "buildpack"}).and_return(buildpack_framework)
- end
-
- it "it uses default framework" do
- subject
- last_response.status.should == 201
- decoded_response["entity"]["framework_guid"].should == buildpack_framework.guid
- end
- end
-
- context "when runtime is not provided" do
- let(:initial_hash) {{ :name => "maria", :space_guid => space_guid, :framework_guid => framework_guid }}
- let(:buildpack_runtime) { Models::Runtime.make }
-
- before do
- VCAP::CloudController::Models::Runtime.stub(:find).with({:name => "ruby19"}).and_return(buildpack_runtime)
- end
-
- it "it uses default runtime" do
- subject
- last_response.status.should == 201
- decoded_response["entity"]["runtime_guid"].should == buildpack_runtime.guid
- end
- end
end
describe "validations" do
@@ -343,9 +305,7 @@ module VCAP::CloudController
let(:creation_req_for_a) do
Yajl::Encoder.encode(
:name => Sham.name,
- :space_guid => @space_a.guid,
- :framework_guid => Models::Framework.make.guid,
- :runtime_guid => Models::Runtime.make.guid)
+ :space_guid => @space_a.guid)
end
let(:update_req_for_a) do
@@ -464,9 +424,7 @@ module VCAP::CloudController
space = Models::Space.make(:organization => org)
req = Yajl::Encoder.encode(:name => Sham.name,
:space_guid => space.guid,
- :memory => 128,
- :framework_guid => Models::Framework.make.guid,
- :runtime_guid => Models::Runtime.make.guid)
+ :memory => 128)
post("/v2/apps", req, headers_for(make_developer_for_space(space)))
View
10 spec/api/app_summary_spec.rb
@@ -81,16 +81,6 @@ module VCAP::CloudController
}]
end
- it "should return the app framework" do
- decoded_response["framework"]["guid"].should == @app.framework.guid
- decoded_response["framework"]["name"].should == @app.framework.name
- end
-
- it "should return the app runtime" do
- decoded_response["runtime"]["guid"].should == @app.runtime.guid
- decoded_response["runtime"]["name"].should == @app.runtime.name
- end
-
it "should contain the running instances" do
decoded_response["running_instances"].should == @app.instances
end
View
54 spec/api/framework_spec.rb
@@ -1,54 +0,0 @@
-# Copyright (c) 2009-2011 VMware, Inc.
-
-require File.expand_path("../spec_helper", __FILE__)
-
-module VCAP::CloudController
- describe VCAP::CloudController::Framework do
-
- it_behaves_like "a CloudController API", {
- :path => "/v2/frameworks",
- :model => Models::Framework,
- :basic_attributes => [:name, :description],
- :required_attributes => [:name, :description, :internal_info],
- :unique_attributes => :name,
- :one_to_many_collection_ids => {
- :apps => lambda { |framework| Models::App.make }
- }
- }
-
- describe "related permissions" do
- include_context "permissions"
- let(:framework) { Models::Framework.make }
-
- before do
- 3.times { Models::App.make(:space => @space_a, :framework => framework) }
- 2.times { Models::App.make(:space => @space_b, :framework => framework) }
- end
-
- describe "GET /v2/frameworks/:guid?inline-relations-depth=1" do
- it "should limit inlined apps those visible to the user making the call" do
- get "/v2/frameworks/#{framework.guid}", { "inline-relations-depth" => 1 }, headers_for(@space_a_developer)
- last_response.should be_ok
- decoded_response["entity"]["apps"].count.should == 3
-
- get "/v2/frameworks/#{framework.guid}", { "inline-relations-depth" => 1 }, headers_for(@space_b_developer)
- last_response.should be_ok
- decoded_response["entity"]["apps"].count.should == 2
- end
- end
-
- describe "GET /v2/frameworks/:guid/apps" do
- it "should limit inlined apps those visible to the user making the call" do
- get "/v2/frameworks/#{framework.guid}/apps", {}, headers_for(@space_a_developer)
- last_response.should be_ok
- decoded_response["total_results"].should == 3
-
- get "/v2/frameworks/#{framework.guid}/apps", {}, headers_for(@space_b_developer)
- last_response.should be_ok
- decoded_response["total_results"].should == 2
- end
- end
- end
-
- end
-end
View
162 spec/api/legacy_apps_spec.rb
@@ -289,40 +289,13 @@ module VCAP::CloudController
describe "POST /apps" do
before do
- ["java", "ruby18"].each do |r|
- unless Models::Runtime[:name => r]
- Models::Runtime.make(:name => r)
- end
- end
-
- Models::Framework.find_or_create(:name => "sinatra") do |fw|
- fw.update(
- :description => "sinatra",
- :internal_info => {
- :runtimes => [ "ruby18" => { :default => true } ]
- }
- )
- end
-
- Models::Framework.find_or_create(:name => "grails") do |fw|
- fw.update(
- :description => "grails",
- :internal_info => {
- :runtimes => [ "java" => { :default => true } ]
- }
- )
- end
-
3.times { Models::App.make }
@num_apps_before = Models::App.count
end
context "with all required parameters" do
before do
- req = Yajl::Encoder.encode({
- :name => app_name,
- :staging => { :framework => "sinatra", :runtime => "ruby18" },
- })
+ req = Yajl::Encoder.encode(:name => app_name)
post "/apps", req, headers_for(user)
end
@@ -347,93 +320,6 @@ module VCAP::CloudController
end
end
- context "with legacy yeti style framework and runtime [TEAM-61]" do
- before do
- req = Yajl::Encoder.encode({
- :name => app_name,
- :staging => { :model => "sinatra", :stack => "ruby18" }
- })
-
- @num_apps_before = Models::App.count
- post "/apps", req, headers_for(user)
- end
-
- it "should return a redirect" do
- last_response.status.should == 302
- end
-
- it "should add the app to default app space" do
- app = user.default_space.apps.find(:name => app_name)
- app.should_not be_nil
- Models::App.count.should == @num_apps_before + 1
- end
- end
-
- context "with an invalid framework" do
- before do
- req = Yajl::Encoder.encode({
- :name => app_name,
- :staging => { :framework => "funky", :runtime => "ruby18" },
- })
-
- @num_apps_before = Models::App.count
- post "/apps", req, headers_for(user)
- end
-
- it "should return bad request" do
- last_response.status.should == 400
- end
-
- it "should not add an app" do
- Models::App.count.should == @num_apps_before
- end
-
- it_behaves_like "a vcap rest error response", /framework is invalid: funky/
- end
-
- context "with an invalid runtime" do
- before do
- req = Yajl::Encoder.encode({
- :name => app_name,
- :staging => { :framework => "sinatra", :runtime => "cobol" },
- })
-
- @num_apps_before = Models::App.count
- post "/apps", req, headers_for(user)
- end
-
- it "should return bad request" do
- last_response.status.should == 400
- end
-
- it "should not add an app" do
- Models::App.count.should == @num_apps_before
- end
-
- it_behaves_like "a vcap rest error response", /runtime is invalid: cobol/
- end
-
- context "with a nil runtime" do
- before do
- req = Yajl::Encoder.encode({
- :name => app_name,
- :staging => { :framework => "grails" }
- })
-
- post "/apps", req, headers_for(user)
- end
-
- it "should return a redirect" do
- last_response.status.should == 302
- end
-
- it "should set a default runtime" do
- app = user.default_space.apps_dataset[:name => app_name]
- app.should_not be_nil
- app.runtime.name.should == "java"
- end
- end
-
context "with uris" do
context "with a valid route" do
let(:host) { Sham.host }
@@ -441,7 +327,6 @@ module VCAP::CloudController
before do
req = Yajl::Encoder.encode({
:name => app_name,
- :staging => { :framework => "grails" },
:uris => ["#{host}.#{DEFAULT_SERVING_DOMAIN_NAME}"]
})
@@ -477,7 +362,6 @@ module VCAP::CloudController
req = Yajl::Encoder.encode({
:name => app_name,
- :staging => { :framework => "grails" },
:uris => ["#{host}.#{domain}"]
})
@@ -505,7 +389,6 @@ module VCAP::CloudController
before do
req = Yajl::Encoder.encode({
:name => app_name,
- :staging => { :framework => "grails" },
:uris => ["#{Sham.host}.#{DEFAULT_SERVING_DOMAIN_NAME}",
"anotherroute.#{taken_domain_name}"]
})
@@ -531,10 +414,6 @@ module VCAP::CloudController
it "should add the environment variable if its legal" do
legacy_req = Yajl::Encoder.encode(
"name" => "app_with_env",
- "staging" => {
- "framework" => "grails",
- "runtime" => "java",
- },
"env" => [
"jesse=awesome",
],
@@ -550,10 +429,6 @@ module VCAP::CloudController
it "should not allow environment variables that start with vcap_" do
legacy_req = Yajl::Encoder.encode(
"name" => "app_with_env",
- "staging" => {
- "framework" => "grails",
- "runtime" => "java",
- },
"env" => [
"vcap_foo=bar",
],
@@ -567,10 +442,6 @@ module VCAP::CloudController
it 'should not allow environment variables that start with vmc_' do
legacy_req = Yajl::Encoder.encode(
"name" => "app_with_env",
- "staging" => {
- "framework" => "grails",
- "runtime" => "java",
- },
"env" => [
"vmc_foo=bar",
],
@@ -586,11 +457,7 @@ module VCAP::CloudController
it "should set the staging command if one is set" do
legacy_req = Yajl::Encoder.encode(
"name" => "app_with_cmd",
- "staging" => {
- "framework" => "grails",
- "runtime" => "java",
- "command" => "foobar",
- }
+ "staging" => { "command" => "foobar" }
)
post "/apps", legacy_req, headers_for(user)
@@ -605,11 +472,7 @@ module VCAP::CloudController
it "should set the console if one is set" do
legacy_req = Yajl::Encoder.encode(
"name" => "app_with_console",
- "console" => true,
- "staging" => {
- "framework" => "grails",
- "runtime" => "java",
- }
+ "console" => true
)
post "/apps", legacy_req, headers_for(user)
@@ -625,11 +488,7 @@ module VCAP::CloudController
it "should set debug if one is set" do
legacy_req = Yajl::Encoder.encode(
"name" => "app_with_debug",
- "debug" => "suspend",
- "staging" => {
- "framework" => "grails",
- "runtime" => "java"
- }
+ "debug" => "suspend"
)
post "/apps", legacy_req, headers_for(user)
@@ -663,19 +522,6 @@ module VCAP::CloudController
end
end
- context "with an invalid runtime" do
- before do
- req = Yajl::Encoder.encode(:staging => { :runtime => "cobol" })
- put "/apps/#{app_obj.name}", req, headers_for(user)
- end
-
- it "should return bad request" do
- last_response.status.should == 400
- end
-
- it_behaves_like "a vcap rest error response", /runtime is invalid: cobol/
- end
-
describe "with env" do
it "should add the environment variable if its legal" do
Models::App.make(
View
5 spec/api/legacy_bulk_spec.rb
@@ -37,9 +37,9 @@ module VCAP::CloudController
describe "GET", "/bulk/apps" do
before :all do
reset_database
- @framework = Models::Framework.make
+
100.times do
- Models::App.make(:framework => @framework)
+ Models::App.make
end
end
@@ -86,7 +86,6 @@ module VCAP::CloudController
decoded_response["results"].each { |key,value|
value.should be_kind_of Hash
value["id"].should_not be_nil
- value["framework"].should == @framework.name
value["version"].should_not be_nil
}
end
View
28 spec/api/legacy_info_spec.rb
@@ -518,33 +518,5 @@ module VCAP::CloudController
}
end
end
-
- describe "GET", "/info", "unauthenticated" do
- it "contains frameworks" do
- fw = Models::Framework.make
- rt = Models::Runtime.make
- fw.internal_info["runtimes"] = [{rt.name => { :default => true }}]
- fw.save
- get "/info"
- last_response.status.should == 200
- decoded_response.should include("frameworks")
- decoded_response["frameworks"].should include(fw.name)
- fw_response = decoded_response["frameworks"][fw.name]
- fw_response.should have_key("runtimes")
- fw_response["runtimes"].should be_kind_of(Array)
- fw_response["runtimes"].first.should be_kind_of(Hash)
- fw_response["runtimes"].first["name"].should == rt.name
- end
- end
-
- describe "GET", "/info/runtimes", "unauthenticated" do
- it "contains runtimes" do
- rt = Models::Runtime.make
- get "/info/runtimes"
- last_response.status.should == 200
- decoded_response.should include(rt.name)
- decoded_response[rt.name].should be_kind_of(Hash)
- end
- end
end
end
View
34 spec/api/runtime_spec.rb
@@ -1,34 +0,0 @@
-# Copyright (c) 2009-2011 VMware, Inc.
-
-require File.expand_path("../spec_helper", __FILE__)
-
-module VCAP::CloudController
- describe VCAP::CloudController::Runtime do
-
- it_behaves_like "a CloudController API", {
- :path => "/v2/runtimes",
- :model => Models::Runtime,
- :basic_attributes => [:name, :description],
- :required_attributes => [:name, :description, :internal_info],
- :unique_attributes => :name,
- :one_to_many_collection_ids => {
- :apps => lambda { |framework| Models::App.make }
- }
- }
-
- describe "GET /v2/runtimes/:guid" do
- let (:runtime) { Models::Runtime.make }
- let (:headers) do
- user = VCAP::CloudController::Models::User.make
- headers_for(user)
- end
-
- it "should include the version field" do
- get "/v2/runtimes/#{runtime.guid}", {}, headers
- last_response.should be_ok
- decoded_response["entity"]["version"].should == runtime.version
- end
- end
-
- end
-end
View
4 spec/api/space_summary_spec.rb
@@ -107,9 +107,7 @@ module VCAP::CloudController
}],
"service_count" => num_services,
"instances" => app.instances,
- "running_instances" => expected_running_instances,
- "framework" => {"name" => app.framework.name},
- "runtime" => {"name" => app.runtime.name}
+ "running_instances" => expected_running_instances
}.merge(app.to_hash)
end
end
View
3  spec/app_stager_spec.rb
@@ -499,9 +499,6 @@ def store_app_package(app)
it "includes misc app properties" do
request.tap do |r|
r[:properties][:meta].should be_kind_of(Hash)
- r[:properties][:runtime_info].should be_kind_of(Hash)
- r[:properties][:runtime_info].should have_key(:name)
- r[:properties][:framework_info].should be_kind_of(Hash)
end
end
View
10 spec/config_spec.rb
@@ -11,16 +11,6 @@ module VCAP::CloudController
}.to raise_error(Errno::ENOENT, /No such file or directory - nonexistent.yml/)
end
- it "adds default runtime file path" do
- config = Config.from_file(File.expand_path("../fixtures/config/minimal_config.yml", __FILE__))
- config[:runtimes_file].should == File.join(Config.config_dir, "runtimes.yml")
- end
-
- it "adds default frameworks directory path" do
- config = Config.from_file(File.expand_path("../fixtures/config/minimal_config.yml", __FILE__))
- config[:directories][:staging_manifests].should == File.join(Config.config_dir, "frameworks")
- end
-
it "adds default stack file path" do
config = Config.from_file(File.expand_path("../fixtures/config/minimal_config.yml", __FILE__))
config[:stacks_file].should == File.join(Config.config_dir, "stacks.yml")
View
2  spec/dea/dea_client_spec.rb
@@ -39,8 +39,6 @@ module VCAP::CloudController
res = DeaClient.send(:start_app_message, @app)
res.should be_kind_of(Hash)
res[:droplet].should == @app.guid
- res[:runtime_info].should be_kind_of(Hash)
- res[:runtime_info].should have_key(:name)
res[:services].should be_kind_of(Array)
res[:services].count.should == NUM_SVC_INSTANCES
res[:services].first.should be_kind_of(Hash)
View
76 spec/dea/dea_pool_spec.rb
@@ -13,8 +13,7 @@ module VCAP::CloudController
{
:id => "dea-id",
:stacks => ["stack"],
- :available_memory => 1024,
- :runtimes => ["ruby18", "java"],
+ :available_memory => 1024
}
end
@@ -25,7 +24,7 @@ module VCAP::CloudController
mock_nats.publish("dea.advertise", JSON.dump(dea_advertise_msg))
end
end
- subject.find_dea(0, "ruby18", "stack").should == "dea-id"
+ subject.find_dea(0, "stack").should == "dea-id"
end
end
@@ -35,15 +34,14 @@ module VCAP::CloudController
{
:id => "dea-id",
:stacks => ["stack"],
- :available_memory => 1024,
- :runtimes => ["ruby18"],
+ :available_memory => 1024
}
end
it "only finds registered deas" do
expect {
subject.process_advertise_message(dea_advertise_msg)
- }.to change { subject.find_dea(0, "ruby18", "stack") }.from(nil).to("dea-id")
+ }.to change { subject.find_dea(0, "stack") }.from(nil).to("dea-id")
end
end
@@ -52,8 +50,7 @@ module VCAP::CloudController
{
:id => "dea-id",
:stacks => ["stack"],
- :available_memory => 1024,
- :runtimes => ["ruby18"],
+ :available_memory => 1024
}
end
@@ -62,10 +59,10 @@ module VCAP::CloudController
subject.process_advertise_message(dea_advertise_msg)
Timecop.travel(10)
- subject.find_dea(1024, "ruby18", "stack").should == "dea-id"
+ subject.find_dea(1024, "stack").should == "dea-id"
Timecop.travel(1)
- subject.find_dea(1024, "ruby18", "stack").should be_nil
+ subject.find_dea(1024, "stack").should be_nil
end
end
end
@@ -75,60 +72,14 @@ module VCAP::CloudController
{
:id => "dea-id",
:stacks => ["stack"],
- :available_memory => 1024,
- :runtimes => ["ruby18"],
+ :available_memory => 1024
}
end
it "only finds deas that can satisfy memory request" do
subject.process_advertise_message(dea_advertise_msg)
- subject.find_dea(1025, "ruby18", "stack").should be_nil
- subject.find_dea(1024, "ruby18", "stack").should == "dea-id"
- end
- end
-
- describe "runtime availability" do
- let(:dea_advertise_msg) do
- {
- :id => "dea-id",
- :stacks => ["stack"],
- :available_memory => 1024,
- :runtimes => ["ruby18"],
- }
- end
-
- it "only finds deas that can satisfy runtime request" do
- subject.process_advertise_message(dea_advertise_msg)
- subject.find_dea(0, "ruby19", "stack").should be_nil
- subject.find_dea(0, "ruby18", "stack").should == "dea-id"
- end
- end
-
- describe "buildpack availability" do
- let(:dea_with_runtimes) do
- {
- :id => "dea-with-runtimes-id",
- :stacks => ["stack"],
- :available_memory => 1024,
- :runtimes => ["ruby18"],
- }
- end
-
- let(:dea_without_runtimes) do
- {
- :id => "dea-without-runtimes-id",
- :stacks => ["stack"],
- :available_memory => 1024,
- :runtimes => nil,
- }
- end
-
- it "only finds deas that do not have runtimes specified" do
- subject.process_advertise_message(dea_with_runtimes)
- subject.find_dea(0, "some-runtime", "stack").should be_nil
-
- subject.process_advertise_message(dea_without_runtimes)
- subject.find_dea(0, "some-runtime", "stack").should == "dea-without-runtimes-id"
+ subject.find_dea(1025, "stack").should be_nil
+ subject.find_dea(1024, "stack").should == "dea-id"
end
end
@@ -137,15 +88,14 @@ module VCAP::CloudController
{
:id => "dea-id",
:available_memory => 1024,
- :stacks => ["known-stack"],
- :runtimes => ["ruby18"],
+ :stacks => ["known-stack"]
}
end
it "only finds deas that can satisfy stack request" do
subject.process_advertise_message(dea_advertise_msg)
- subject.find_dea(0, "ruby18", "unknown-stack").should be_nil
- subject.find_dea(0, "ruby18", "known-stack").should == "dea-id"
+ subject.find_dea(0, "unknown-stack").should be_nil
+ subject.find_dea(0, "known-stack").should == "dea-id"
end
end
end
View
10 spec/models/app_spec.rb
@@ -15,13 +15,11 @@ module VCAP::CloudController
let(:route) { Models::Route.make(:domain => domain, :space => space) }
it_behaves_like "a CloudController model", {
- :required_attributes => [:name, :framework, :runtime, :space],
+ :required_attributes => [:name, :space],
:unique_attributes => [:space, :name],
:stripped_string_attributes => :name,
:many_to_one => {
:space => lambda { |app| Models::Space.make },
- :framework => lambda { |app| Models::Framework.make },
- :runtime => lambda { |app| Models::Runtime.make },
:stack => lambda { |app| Models::Stack.make },
},
:one_to_zero_or_more => {
@@ -74,8 +72,6 @@ def self.it_always_sets_stack
subject do
Models::App.new(
:name => Sham.name,
- :framework => Models::Framework.make,
- :runtime => Models::Runtime.make,
:space => space,
)
end
@@ -433,8 +429,6 @@ def self.it_always_sets_stack
describe "adding routes to unsaved apps" do
it "should set a route by guid on a new but unsaved app" do
app = Models::App.new(:name => Sham.name,
- :framework => Models::Framework.make,
- :runtime => Models::Runtime.make,
:space => space,
:stack => Models::Stack.make)
app.add_route_by_guid(route.guid)
@@ -444,8 +438,6 @@ def self.it_always_sets_stack
it "should not allow a route on a domain from another org" do
app = Models::App.new(:name => Sham.name,
- :framework => Models::Framework.make,
- :runtime => Models::Runtime.make,
:space => space,
:stack => Models::Stack.make)
app.add_route_by_guid(Models::Route.make.guid)
View
36 spec/models/framework_spec.rb
@@ -1,36 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-require File.expand_path("../spec_helper", __FILE__)
-
-module VCAP::CloudController
- describe VCAP::CloudController::Models::Framework do
- it_behaves_like "a CloudController model", {
- :required_attributes => [:name, :description, :internal_info],
- :unique_attributes => :name,
- :stripped_string_attributes => :name,
- :one_to_zero_or_more => {
- :apps => lambda { |service_binding| Models::App.make }
- }
- }
-
- describe ".populate_from_directory" do
- it "should load frameworks" do
- dir = File.expand_path("../../../config/frameworks", __FILE__)
- reset_database
- Models::Framework.populate_from_directory(dir)
- sinatra = Models::Framework.find(:name => "sinatra")
- sinatra.should be_valid
- end
- end
-
- describe "#internal_info" do
- it "should serialize and deserialize hashes" do
- dir = File.expand_path("../../../config/frameworks", __FILE__)
- Models::Framework.populate_from_directory(dir)
- sinatra = Models::Framework.find(:name => "sinatra")
- sinatra.internal_info.should_not be_nil
- sinatra.internal_info["runtimes"].size.should == 3
- end
- end
- end
-end
View
36 spec/models/runtime_spec.rb
@@ -1,36 +0,0 @@
-# Copyright (c) 2009-2012 VMware, Inc.
-
-require File.expand_path("../spec_helper", __FILE__)
-
-module VCAP::CloudController
- describe VCAP::CloudController::Models::Runtime do
- it_behaves_like "a CloudController model", {
- :required_attributes => [:name, :description, :internal_info],
- :unique_attributes => :name,
- :stripped_string_attributes => :name,
- :one_to_zero_or_more => {
- :apps => lambda { |service_binding| Models::App.make }
- }
- }
-
- describe ".populate_from_file" do
- it "should load runtimes" do
- yml = File.expand_path("../../../config/runtimes.yml", __FILE__)
- reset_database
- Models::Runtime.populate_from_file(yml)
- java = Models::Runtime.find(:name => "java")
- java.should be_valid
- end
- end
-
- describe "#internal_info" do
- it "should serialize and deserialize hashes" do
- yml = File.expand_path("../../../config/runtimes.yml", __FILE__)
- Models::Runtime.populate_from_file(yml)
- java = Models::Runtime.find(:name => "java")
- java.internal_info.should_not be_nil
- java.internal_info["version"].should == "1.6"
- end
- end
- end
-end
View
14 spec/stager_pool_spec.rb
@@ -7,7 +7,7 @@ module VCAP::CloudController
let(:mock_nats) { NatsClientMock.new({}) }
let(:message_bus) { MessageBus.new(:nats => mock_nats) }
subject { StagerPool.new(config, message_bus) }
-
+
describe "#register_subscriptions" do
let(:staging_advertise_msg) do
{
@@ -16,7 +16,7 @@ module VCAP::CloudController
:available_memory => 1024,
}
end
-
+
it "finds advertised stagers" do
with_em_and_thread do
subject.register_subscriptions
@@ -58,20 +58,20 @@ module VCAP::CloudController
:available_memory => 1024,
}
end
-
+
it "only finds deas with that have not expired" do
Timecop.freeze do
subject.process_advertise_message(staging_advertise_msg)
-
+
Timecop.travel(10)
subject.find_stager("stack-name", 1024).should == "staging-id"
-
+
Timecop.travel(1)
subject.find_stager("stack-name", 1024).should be_nil
end
end
end
-
+
describe "memory capacity" do
let(:staging_advertise_msg) do
{
@@ -97,7 +97,7 @@ module VCAP::CloudController
}
end
- it "only finds deas that can satisfy runtime request" do
+ it "only finds deas that can satisfy stack request" do
subject.process_advertise_message(staging_advertise_msg)
expect { subject.find_stager("unknown-stack-name", 0) }.to raise_error(Errors::StackNotFound)
subject.find_stager("known-stack-name", 0).should == "staging-id"
View
14 spec/support/fakes/blueprints.rb
@@ -90,18 +90,6 @@ module VCAP::CloudController::Models
service_plan { ServicePlan.make }
end
- Runtime.blueprint do
- name { Sham.name }
- description { Sham.description }
- internal_info { {:version => Sham.version} }
- end
-
- Framework.blueprint do
- name { Sham.name }
- description { Sham.description }
- internal_info { { :runtimes => [ Runtime.make.name => { :default => true } ] } }
- end
-
Stack.blueprint do
name { Sham.name }
description { Sham.description }
@@ -110,8 +98,6 @@ module VCAP::CloudController::Models
App.blueprint do
name { Sham.name }
space { Space.make }
- runtime { Runtime.make }
- framework { Framework.make }
stack { Stack.make }
end
Please sign in to comment.
Something went wrong with that request. Please try again.