Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/controllers/runtime/info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def read

info[:user] = user.guid if user

unless @config.get(:temporary_enable_v2)
info[:support] = 'CF API v2 is disabled'
info[:api_version] = ''
end

Oj.dump(info, mode: :compat)
end
end
Expand Down
19 changes: 19 additions & 0 deletions spec/unit/controllers/runtime/info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ module VCAP::CloudController
expect(hash['min_recommended_cli_version']).to eq('min_recommended_cli_version')
end

it 'returns limited info when cc.temporary_enable_v2 is disabled' do
TestConfig.override(temporary_enable_v2: false)

get '/v2/info'
hash = Oj.load(last_response.body)
expect(hash['name']).to eq(TestConfig.config[:info][:name])
expect(hash['build']).to eq(TestConfig.config[:info][:build])
expect(hash['support']).to eq('CF API v2 is disabled')
expect(hash['version']).to eq(TestConfig.config[:info][:version])
expect(hash['description']).to eq(TestConfig.config[:info][:description])
expect(hash['authorization_endpoint']).to eq(TestConfig.config[:login][:url])
expect(hash['token_endpoint']).to eq(TestConfig.config[:uaa][:url])
expect(hash['app_ssh_endpoint']).to eq(TestConfig.config[:info][:app_ssh_endpoint])
expect(hash['app_ssh_host_key_fingerprint']).to eq(TestConfig.config[:info][:app_ssh_host_key_fingerprint])
expect(hash['app_ssh_oauth_client']).to eq(TestConfig.config[:info][:app_ssh_oauth_client])
expect(hash['api_version']).to eq('')
expect(hash['osbapi_version']).to eq(VCAP::CloudController::Constants::OSBAPI_VERSION)
end

describe 'custom fields' do
context 'without custom fields in config' do
before { TestConfig.override(info: {}) }
Expand Down