Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add health to app summary

Change-Id: Ifeb0a784b6afb0ae2d836ec3e05640693fbe4662
  • Loading branch information...
commit 57be3a056f4e5cf662cee922b4087184691cdffe 1 parent daeb231
@pbozeman pbozeman authored
View
10 lib/cloud_controller/api/app_summary.rb
@@ -16,13 +16,13 @@ module VCAP::CloudController
def summary(id)
app = find_id_and_validate_access(:read, id)
-
- Yajl::Encoder.encode(
+ app_info = {
:guid => app.guid,
:name => app.name,
:urls => app.routes.map(&:fqdn),
: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 do |instance|
{
:guid => instance.guid,
@@ -33,8 +33,10 @@ def summary(id)
:plan_guid => instance.service_plan.guid,
:plan_name => instance.service_plan.name,
}
- end,
- )
+ end
+ }.merge(app.to_hash)
+
+ Yajl::Encoder.encode(app_info)
end
get "#{path_id}/summary", :summary
View
14 spec/api/app_summary_spec.rb
@@ -37,7 +37,9 @@ module VCAP::CloudController
end
describe "GET /v2/apps/:id/summary" do
- before :all do
+ before do
+ HealthManagerClient.should_receive(:healthy_instances).
+ and_return(@app.instances)
get "/v2/apps/#{@app.guid}/summary", {}, admin_headers
end
@@ -67,6 +69,16 @@ module VCAP::CloudController
decoded_response["runtime"]["name"].should == @app.runtime.name
end
+ it "should contain the running instances" do
+ decoded_response["running_instances"].should == @app.instances
+ end
+
+ it "should contain the basic app attributes" do
+ @app.to_hash.each do |k, v|
+ decoded_response[k.to_s].should == v
+ end
+ end
+
it "should return num_services services" do
decoded_response["services"].size.should == num_services
end
Please sign in to comment.
Something went wrong with that request. Please try again.