Skip to content
Draft
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
1 change: 0 additions & 1 deletion .rubocop_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ Style/TernaryParentheses:
Style/YAMLFileRead:
Enabled: true


#### DISABLED SECTION
Lint/ShadowedException: # Breaks "bundle exec rake rubocop" if enabled
Enabled: false
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.10
4.0.2
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just chosen as our internal CI servers didn't have access to newer versions yet, we should upgrade this to latest before merging

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source 'https://rubygems.org'

gem 'addressable'
gem 'bootsnap', require: false
gem 'cgi'
gem 'clockwork', require: false
gem 'cloudfront-signer'
gem 'concurrent-ruby'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ GEM
httpclient (~> 2.8, >= 2.8.2.4)
json (~> 2.7)
mutex_m
cgi (0.5.1)
clockwork (4.0.1)
activesupport
tzinfo
Expand Down Expand Up @@ -616,6 +617,7 @@ DEPENDENCIES
bootsnap
byebug
cf-uaa-lib (~> 4.0.9)
cgi
clockwork
cloudfront-signer
codeclimate-test-reporter (>= 1.0.8)
Expand Down
2 changes: 1 addition & 1 deletion db/migrations/20220601183937_create_asg_lastest_updates.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Sequel.migration do
change do
create_table :asg_timestamps do
primary_key name: :id
primary_key :id, name: :id
Timestamp :last_update
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Sequel.migration do
change do
alter_table :asg_timestamps do
rename_column :'{:name=>:id}', :id
end
up do
# no op
end

down do
# no op
end
end
2 changes: 1 addition & 1 deletion spec/unit/controllers/v3/sidecars_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
it 'fails to map a route' do
expect do
get :index_by_process
end.to raise_error(ActionController::UrlGenerationError, /No route matches \{:action=>"index_by_process", :controller=>"sidecars"\}/)
end.to raise_error(ActionController::UrlGenerationError, /No route matches \{action: "index_by_process", controller: "sidecars"\}/)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/jobs/pollable_job_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class BigException < StandardError
pg_error = /value too long for type character varying/
mysql_error = /Data too long for column 'cf_api_error'/
expect do
pollable_job.error(job, BigException.new(message: 'x' * 15_828))
pollable_job.error(job, BigException.new(message: 'x' * 16_000))
end.to raise_error(::Sequel::DatabaseError, /#{pg_error}|#{mysql_error}/)
end
end
Expand Down
18 changes: 9 additions & 9 deletions spec/unit/lib/services/service_brokers/v2/http_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ module VCAP::Services::ServiceBrokers::V2

it 'logs the default headers' do
make_request
expect(fake_logger).to have_received(:debug).with(match(%r{Accept"=>"application/json}))
expect(fake_logger).to have_received(:debug).with(match(/X-VCAP-Request-ID"=>"[[:alnum:]-]+/))
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-API-Request-Identity"=>"[[:alnum:]-]+/))
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-Api-Version"=>"2\.15/))
expect(fake_logger).to have_received(:debug).with(match(%r{Accept" => "application/json}))
expect(fake_logger).to have_received(:debug).with(match(/X-VCAP-Request-ID" => "[[:alnum:]-]+/))
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-API-Request-Identity" => "[[:alnum:]-]+/))
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-Api-Version" => "2\.15/))
api_info_path = TestConfig.config[:temporary_enable_v2] ? '/v2/info' : '/'
expect(fake_logger).to have_received(:debug).with(match(/X-Api-Info-Location"=>"api2\.127\.0\.0\.1\.nip\.io#{api_info_path}/))
expect(fake_logger).to have_received(:debug).with(match(/X-Api-Info-Location" => "api2\.127\.0\.0\.1\.nip\.io#{api_info_path}/))
end

context 'when an https URL is used' do
Expand Down Expand Up @@ -357,12 +357,12 @@ def expect_timeout_to_be(timeout)

it 'redacts credentials from response body' do
make_request
expect(fake_logger).to have_received(:debug).with(/"credentials"=>"\[REDACTED\]"/)
expect(fake_logger).to have_received(:debug).with(/"credentials" => "\[REDACTED\]"/)
end

it 'does not redact other keys' do
make_request
expect(fake_logger).to have_received(:debug).with(%r{"syslog_drain_url"=>"example.com/1234"})
expect(fake_logger).to have_received(:debug).with(%r{"syslog_drain_url" => "example.com/1234"})
end

context 'non-json responses' do
Expand Down Expand Up @@ -507,7 +507,7 @@ def expect_timeout_to_be(timeout)

it 'logs the Content-Type Header' do
make_request
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type"=>"application/json"}))
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type" => "application/json"}))
end

it 'has a content body' do
Expand Down Expand Up @@ -584,7 +584,7 @@ def expect_timeout_to_be(timeout)

it 'logs the Content-Type Header' do
make_request
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type"=>"application/json"}))
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type" => "application/json"}))
end

it 'has a content body' do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/models/runtime/feature_flag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ module VCAP::CloudController
feature_flag_overrides = { diego_docker: 'an invalid value', user_org_creation: false }
expect do
FeatureFlag.override_default_flags(feature_flag_overrides)
end.to raise_error('Invalid feature flag value(s): {:diego_docker=>"an invalid value"}')
end.to raise_error('Invalid feature flag value(s): {diego_docker: "an invalid value"}')
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/presenters/error_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def response_code
let(:error) { StandardError.new }

it 'logs the response code and unsanitized error hash' do
expect(presenter.log_message).to eq('Request failed: 500: {"fake"=>"insane"}')
expect(presenter.log_message).to eq('Request failed: 500: {"fake" => "insane"}')
end
end

Expand Down
10 changes: 5 additions & 5 deletions spec/unit/support/matchers/be_a_response_like_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
it 'fails when hash values within arrays do not match' do
expect do
expect({ 'a' => [{ 'b' => 1 }] }).to be_a_response_like({ 'a' => [{ 'b' => 2 }] })
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"b"=>2}', actual: '+ a[0]: {"b"=>1}')
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"b" => 2}', actual: '+ a[0]: {"b" => 1}')
end

it 'fails when hash keys within arrays do not match' do
expect do
expect({ 'a' => [{ 'b' => 1 }] }).to be_a_response_like({ 'a' => [{ 'c' => 1 }] })
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"c"=>1}', actual: '+ a[0]: {"b"=>1}')
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"c" => 1}', actual: '+ a[0]: {"b" => 1}')
end

it 'fails when actual is empty but expected is an empty array' do
Expand All @@ -88,14 +88,14 @@
it 'fails when actual as a non-empty but expected is an empty array' do
expect do
expect({ 'a' => [{ 'b' => 1 }] }).to be_a_response_like({ 'a' => [] })
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{"b"=>1\}/)
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{"b" => 1\}/)
end

it 'fails on deeply nested value mismatches' do
expect do
expect({ 'a' => [{ 'a' => { 'a' => [{ 'a' => 1 }, { 'b' => 2 }] } }] }).to be_a_response_like({ 'a' => [{ 'a' => { 'a' => [{ 'a' => 1 }, { 'b' => 1 }] } }] })
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {"b"=>1}',
actual: '+ a[0].a.a[1]: {"b"=>2}')
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {"b" => 1}',
actual: '+ a[0].a.a[1]: {"b" => 2}')
end

def raise_expectation_not_met_with_summary(ptn)
Expand Down
10 changes: 5 additions & 5 deletions spec/unit/support/matchers/match_json_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
it 'fails when hash values within arrays do not match' do
expect do
expect({ 'a' => [{ 'b' => 1 }] }).to match_json_response({ a: [{ b: 2 }] })
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {:b=>2}', actual: '+ a[0]: {:b=>1}')
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {b: 2}', actual: '+ a[0]: {b: 1}')
end

it 'fails when hash keys within arrays do not match' do
expect do
expect({ 'a' => [{ 'b' => 1 }] }).to match_json_response({ a: [{ c: 1 }] })
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {:c=>1}', actual: '+ a[0]: {:b=>1}')
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {c: 1}', actual: '+ a[0]: {b: 1}')
end

it 'fails when actual is empty but expected is an empty array' do
Expand All @@ -88,14 +88,14 @@
it 'fails when actual as a non-empty but expected is an empty array' do
expect do
expect({ 'a' => [{ 'b' => 1 }] }).to match_json_response({ a: [] })
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{:b=>1\}/)
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{b: 1\}/)
end

it 'fails on deeply nested value mismatches' do
expect do
expect({ 'a' => [{ 'a' => { 'a' => [{ 'a' => 1 }, { 'b' => 2 }] } }] }).to match_json_response({ a: [{ a: { a: [{ a: 1 }, { b: 1 }] } }] })
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {:b=>1}',
actual: '+ a[0].a.a[1]: {:b=>2}')
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {b: 1}',
actual: '+ a[0].a.a[1]: {b: 2}')
end

it 'outputs submatcher error message when it errors' do
Expand Down
Loading