From 7601d8c2565add92d87e25006ac44c33394fd311 Mon Sep 17 00:00:00 2001 From: Josh Russett <34522279+jrussett@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:53:36 -0700 Subject: [PATCH] Update rubocop config + update bosh template spec tests (#394) * Update routing's rubocop configuration I tried to run rubocop the other day and it was an absolute mess. This PR updates the rubocop config in routing-release and updates all of the bosh template spec tests appropriately. The update strategy is based on what exists in CAPI and this PR specifically: - https://github.com/cloudfoundry/cloud_controller_ng/pull/3448 * Enable `rubocop-rspec` and regen rubocop_todo.yml We'll get this these... eventually... maybe. --- .gitignore | 1 - .rubocop.yml | 16 ++++ .rubocop_routing.yml | 36 +++++++ .rubocop_todo.yml | 133 ++++++++++++++++++++++++++ scripts/staged_shortlog | 4 +- spec/gorouter_templates_spec.rb | 63 ++++++------ spec/haproxy_config_spec.rb | 13 ++- spec/route_registar_templates_spec.rb | 41 ++++---- spec/routing_api_templates_spec.rb | 7 +- spec/spec_helper.rb | 12 +-- spec/tcp_router_templates_spec.rb | 8 +- 11 files changed, 244 insertions(+), 90 deletions(-) create mode 100644 .rubocop.yml create mode 100644 .rubocop_routing.yml create mode 100644 .rubocop_todo.yml diff --git a/.gitignore b/.gitignore index b8fee3166..98de01f6a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ blobs/ config/dev.yml config/private.yml -/*.yml stub.yml .final_builds/jobs/**/*.tgz .final_builds/packages/**/*.tgz diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..61eaa1af6 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,16 @@ +# We put our own configuration into .rubocop_routing.yml to let it be +# overwritten buy .rubocop_todo.yml. +# The .rubocop_todo.yml is autogenerated with `rubocop --regenerate-todo` and +# ignores old errors for new cops +# Then one can, one by one, remove to ignore from the .rubocop_todo.yml file +# and work on applying new cops also to old codebase. +# +# This was adapted from [cloudfoundry/cloud_controller_ng](https://github.com/cloudfoundry/cloud_controller_ng/blob/a6febf66cf9cf7c86b27b917df9b111b874b6972/.rubocop.yml) + +inherit_from: + - .rubocop_routing.yml + - .rubocop_todo.yml +inherit_mode: + merge: + - Exclude + - Include diff --git a/.rubocop_routing.yml b/.rubocop_routing.yml new file mode 100644 index 000000000..e602e4319 --- /dev/null +++ b/.rubocop_routing.yml @@ -0,0 +1,36 @@ +# Routing Release rubocop config for bosh template tests + +require: + - rubocop-rspec + +AllCops: + TargetRubyVersion: 3.2 + NewCops: enable + +Layout/LineLength: + Max: 200 + +Metrics/BlockLength: + Exclude: + - 'spec/**/*' + Max: 50 + +Metrics/MethodLength: + Max: 60 + +Style/MutableConstant: + EnforcedStyle: literals + +Style/FrozenStringLiteralComment: + EnforcedStyle: always_true + Exclude: + - 'Gemfile' + - 'scripts/staged_shortlog' + +Style/Documentation: + Exclude: + - spec/spec_helper.rb + +Style/SelectByRegexp: + Exclude: + - 'scripts/staged_shortlog' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..fc7b88c7a --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,133 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2024-03-06 23:41:06 UTC using RuboCop version 1.57.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 36 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/routing_api_templates_spec.rb' + +# Offense count: 50 +# Configuration parameters: Prefixes, AllowedPatterns. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/haproxy_config_spec.rb' + - 'spec/routing_api_templates_spec.rb' + +# Offense count: 5 +# Configuration parameters: IgnoredMetadata. +RSpec/DescribeClass: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/haproxy_config_spec.rb' + - 'spec/route_registar_templates_spec.rb' + - 'spec/routing_api_templates_spec.rb' + - 'spec/tcp_router_templates_spec.rb' + +# Offense count: 14 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterExample: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/route_registar_templates_spec.rb' + +# Offense count: 38 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterExampleGroup: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/route_registar_templates_spec.rb' + - 'spec/tcp_router_templates_spec.rb' + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterFinalLet: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/route_registar_templates_spec.rb' + - 'spec/routing_api_templates_spec.rb' + - 'spec/tcp_router_templates_spec.rb' + +# Offense count: 56 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterHook: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/route_registar_templates_spec.rb' + - 'spec/tcp_router_templates_spec.rb' + +# Offense count: 13 +# Configuration parameters: CountAsOne. +RSpec/ExampleLength: + Max: 47 + +# Offense count: 108 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. +# DisallowedExamples: works +RSpec/ExampleWording: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/route_registar_templates_spec.rb' + - 'spec/routing_api_templates_spec.rb' + - 'spec/spec_helper.rb' + - 'spec/tcp_router_templates_spec.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +RSpec/LeadingSubject: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/routing_api_templates_spec.rb' + - 'spec/tcp_router_templates_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +RSpec/MatchArray: + Exclude: + - 'spec/gorouter_templates_spec.rb' + +# Offense count: 34 +RSpec/MultipleExpectations: + Max: 5 + +# Offense count: 254 +# Configuration parameters: AllowSubject. +RSpec/MultipleMemoizedHelpers: + Max: 10 + +# Offense count: 179 +# Configuration parameters: AllowedGroups. +RSpec/NestedGroups: + Max: 7 + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: not_to, to_not +RSpec/NotToNot: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/haproxy_config_spec.rb' + +# Offense count: 4 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/tcp_router_templates_spec.rb' + +# Offense count: 6 +RSpec/RepeatedExampleGroupDescription: + Exclude: + - 'spec/gorouter_templates_spec.rb' + - 'spec/route_registar_templates_spec.rb' + - 'spec/tcp_router_templates_spec.rb' diff --git a/scripts/staged_shortlog b/scripts/staged_shortlog index 1c0587ed8..c17a0628e 100755 --- a/scripts/staged_shortlog +++ b/scripts/staged_shortlog @@ -4,7 +4,7 @@ diffs = `git diff --cached`.split('diff --git').select { |log| log =~ /Subprojec locations = {} diffs.each do |diff| - /a\/(?.+?)\sb.*index\s(?\S+)/m.match diff do |matches| + %r{a/(?.+?)\sb.*index\s(?\S+)}m.match diff do |matches| locations[matches[:loc]] = matches[:shas] end end @@ -14,7 +14,7 @@ puts # Second line of git commit message should always be empty locations.each do |location, shas| Dir.chdir(location) do - remote = `git remote -v`.match(/github.com[\/:]([^\s]+?).git/) + remote = `git remote -v`.match(%r{github.com[/:]([^\s]+?).git}) repo = remote && remote[1] puts "Bump #{repo}" diff --git a/spec/gorouter_templates_spec.rb b/spec/gorouter_templates_spec.rb index 9864f8682..3fb3d34d6 100644 --- a/spec/gorouter_templates_spec.rb +++ b/spec/gorouter_templates_spec.rb @@ -1,8 +1,5 @@ # frozen_string_literal: true -# rubocop:disable Layout/LineLength -# rubocop:disable Metrics/BlockLength - require 'rspec' require 'yaml' require 'json' @@ -119,7 +116,7 @@ 'password' => 'pass', 'tls' => { 'certificate' => TEST_CERT, - 'key' => TEST_KEY, + 'key' => TEST_KEY } }, 'enable_ssl' => true, @@ -856,7 +853,7 @@ context 'not enabled but rules provided' do before do deployment_manifest_fragment['router']['verify_client_certificate_metadata'] = [ - { "issuer_in_chain" => { "common_name" => "test.com" }} + { 'issuer_in_chain' => { 'common_name' => 'test.com' } } ] end it 'does not populate the property' do @@ -870,7 +867,6 @@ before do deployment_manifest_fragment['router']['enable_verify_client_certificate_metadata'] = false deployment_manifest_fragment['router']['verify_client_certificate_metadata'] = [] - end it 'does not populate the property' do expect { parsed_yaml }.not_to raise_error @@ -883,16 +879,15 @@ before do deployment_manifest_fragment['router']['enable_verify_client_certificate_metadata'] = true deployment_manifest_fragment['router']['verify_client_certificate_metadata'] = [ - { "issuer_in_chain" => { "common_name" => "test-with-san.com" }, - "valid_cert_subjects" => [ - {"issuer_in_chain" => { "common_name" => "test.com client cert1" }}, - {"issuer_in_chain" => { "common_name" => "test.com client cert2", "locality" => ["US"] }} - ] - } + { 'issuer_in_chain' => { 'common_name' => 'test-with-san.com' }, + 'valid_cert_subjects' => [ + { 'issuer_in_chain' => { 'common_name' => 'test.com client cert1' } }, + { 'issuer_in_chain' => { 'common_name' => 'test.com client cert2', 'locality' => ['US'] } } + ] } ] end it 'fails generating the template as there are metadata verification rules but no client ca certs' do - expect { parsed_yaml }.to raise_error RuntimeError, "client certificate rules defined, but no client CA defined in `client_ca_certs`" + expect { parsed_yaml }.to raise_error RuntimeError, 'client certificate rules defined, but no client CA defined in `client_ca_certs`' end end context 'enabled with configured client_ca_certs' do @@ -903,12 +898,11 @@ before do deployment_manifest_fragment['router']['enable_verify_client_certificate_metadata'] = true deployment_manifest_fragment['router']['verify_client_certificate_metadata'] = [ - { "issuer_in_chain" => { "common_name" => "test-with-san.com" }, - "valid_cert_subjects" => [ - {"issuer_in_chain" => { "common_name" => "test.com client cert1" }}, - {"issuer_in_chain" => { "common_name" => "test.com client cert2", "locality" => ["US"] }} - ] - } + { 'issuer_in_chain' => { 'common_name' => 'test-with-san.com' }, + 'valid_cert_subjects' => [ + { 'issuer_in_chain' => { 'common_name' => 'test.com client cert1' } }, + { 'issuer_in_chain' => { 'common_name' => 'test.com client cert2', 'locality' => ['US'] } } + ] } ] end it 'populates the properties after a successful check' do @@ -921,12 +915,11 @@ before do deployment_manifest_fragment['router']['enable_verify_client_certificate_metadata'] = true deployment_manifest_fragment['router']['verify_client_certificate_metadata'] = [ - { "issuer_in_chain" => { "common_name" => "test-with-san.com", "country" => ["US"] }, - "valid_cert_subjects" => [ - {"issuer_in_chain" => { "common_name" => "test.com client cert1" }}, - {"issuer_in_chain" => { "common_name" => "test.com client cert2", "locality" => ["US"] }} - ] - } + { 'issuer_in_chain' => { 'common_name' => 'test-with-san.com', 'country' => ['US'] }, + 'valid_cert_subjects' => [ + { 'issuer_in_chain' => { 'common_name' => 'test.com client cert1' } }, + { 'issuer_in_chain' => { 'common_name' => 'test.com client cert2', 'locality' => ['US'] } } + ] } ] end it 'fails and explains the valid cert subjects in the message' do @@ -1230,7 +1223,9 @@ end it 'raises error' do - expect { parsed_yaml }.to raise_error(RuntimeError, "'meow' is not a valid timestamp format for the property 'router.logging.format.timestamp'. Valid options are: 'rfc3339', 'deprecated', and 'unix-epoch'.") + err_msg = "'meow' is not a valid timestamp format for the property 'router.logging.format.timestamp'. Valid options are: 'rfc3339', 'deprecated', and 'unix-epoch'." + + expect { parsed_yaml }.to raise_error(RuntimeError, err_msg) end end @@ -1395,7 +1390,7 @@ context 'when router.status.routes.port is specified' do before do - deployment_manifest_fragment['router']['status']['routes'] = {'port' => 8888} + deployment_manifest_fragment['router']['status']['routes'] = { 'port' => 8888 } end it 'overrides the default value' do @@ -1442,7 +1437,7 @@ deployment_manifest_fragment['router']['status']['tls']['port'] = 1234 end it 'overrides the default' do - expect(parsed_yaml['status']['tls']['port']).to eq 1234 + expect(parsed_yaml['status']['tls']['port']).to eq 1234 end end @@ -1451,7 +1446,7 @@ deployment_manifest_fragment['router']['status']['tls'].delete('certificate') end it 'raises an error about missing certificate values' do - expect {parsed_yaml}.to raise_error(/router.status.tls.certificate must be provided when router.status.tls.port is set/) + expect { parsed_yaml }.to raise_error(/router.status.tls.certificate must be provided when router.status.tls.port is set/) end end context 'but the key is not specified' do @@ -1459,11 +1454,10 @@ deployment_manifest_fragment['router']['status']['tls'].delete('key') end it 'raises an error about missing key values' do - expect {parsed_yaml}.to raise_error(/router.status.tls.key must be provided when router.status.tls.port is set/) + expect { parsed_yaml }.to raise_error(/router.status.tls.key must be provided when router.status.tls.port is set/) end end end - end describe 'healthchecker.yml' do @@ -1498,7 +1492,7 @@ 'user' => 'some-user', 'password' => 'some-password', 'path' => '/is-process-alive-do-not-use-for-loadbalancing', - 'scheme' => 'https', + 'scheme' => 'https' } ) end @@ -1578,7 +1572,7 @@ let(:properties) do { 'router' => { 'port' => 81, - 'status' => { 'port' => 8081, 'tls' => {'port' => 8443}, }, + 'status' => { 'port' => 8081, 'tls' => { 'port' => 8443 } }, 'prometheus' => { 'port' => 7777 }, 'tls_port' => 442, 'debug_address' => '127.0.0.1:17003' @@ -1654,6 +1648,3 @@ end end end - -# rubocop:enable Layout/LineLength -# rubocop:enable Metrics/BlockLength diff --git a/spec/haproxy_config_spec.rb b/spec/haproxy_config_spec.rb index 5a49f558f..6b69a83fe 100644 --- a/spec/haproxy_config_spec.rb +++ b/spec/haproxy_config_spec.rb @@ -10,10 +10,10 @@ let(:properties) do { 'tcp_router' => { - 'oauth_secret' => '', + 'oauth_secret' => '' }, 'uaa' => { - 'tls_port' => 1000, + 'tls_port' => 1000 }, 'routing_api' => { 'mtls_port' => 1337, @@ -22,7 +22,7 @@ } end - ["haproxy.conf", "haproxy.conf.template"].each do |file| + ['haproxy.conf', 'haproxy.conf.template'].each do |file| context "config/#{file}" do let(:template) { tcp_router_job.template("config/#{file}") } @@ -87,7 +87,6 @@ end end - ### The following code has been pulled from https://github.com/cloudfoundry/haproxy-boshrelease/blob/master/spec/spec_helper.rb # converts haproxy config into hash of arrays grouped # by top-level values eg @@ -100,7 +99,7 @@ # } def parse_haproxy_config(config) # rubocop:disable Metrics/AbcSize # remove comments and empty lines - config = config.split(/\n/).reject { |l| l.empty? || l =~ /^\s*#.*$/ }.join("\n") + config = config.split("\n").reject { |l| l.empty? || l =~ /^\s*#.*$/ }.join("\n") # split into top-level groups config.split(/^([^\s].*)/).drop(1).each_slice(2).to_h do |group| @@ -108,10 +107,10 @@ def parse_haproxy_config(config) # rubocop:disable Metrics/AbcSize properties = group[1] # remove empty lines - properties = properties.split(/\n/).reject(&:empty?).join("\n") + properties = properties.split("\n").reject(&:empty?).join("\n") # split and strip leading/trailing whitespace - properties = properties.split(/\n/).map(&:strip) + properties = properties.split("\n").map(&:strip) [key, properties] end diff --git a/spec/route_registar_templates_spec.rb b/spec/route_registar_templates_spec.rb index 36350c944..3c4389be8 100644 --- a/spec/route_registar_templates_spec.rb +++ b/spec/route_registar_templates_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Layout/LineLength -# rubocop: disable Metrics/BlockLength require 'rspec' require 'bosh/template/test' require 'yaml' @@ -218,7 +216,7 @@ describe 'nats properties' do it 'renders with the default' do - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } rendered_hash = JSON.parse(template.render(merged_manifest_properties, consumes: links)) expect(rendered_hash['message_bus_servers'][0]['host']).to eq('nats-host:8080') expect(rendered_hash['message_bus_servers'][0]['user']).to eq('nats-user') @@ -266,7 +264,7 @@ context 'when mTLS is not enabled for NATS' do context 'when nats.fail_if_using_nats_without_tls is false' do it 'renders with the default nat properties' do - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } rendered_hash = JSON.parse(template.render(merged_manifest_properties, consumes: links)) expect(rendered_hash['nats_mtls_config']['enabled']).to be false expect(rendered_hash['message_bus_servers'].length).to eq(1) @@ -277,14 +275,14 @@ end context 'when nats.fail_if_using_nats_without_tls is true' do it 'fails' do - nats_err_msg = <<-TEXT -Using nats (instead of nats-tls) is deprecated. The nats process will -be removed soon. Please migrate to using nats-tls as soon as possible. -If you must continue using nats for a short time you can set the -nats.fail_if_using_nats_without_tls property on route_registrar to -false. -TEXT - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => true } + nats_err_msg = <<~TEXT + Using nats (instead of nats-tls) is deprecated. The nats process will + be removed soon. Please migrate to using nats-tls as soon as possible. + If you must continue using nats for a short time you can set the + nats.fail_if_using_nats_without_tls property on route_registrar to + false. + TEXT + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => true } expect { template.render(merged_manifest_properties, consumes: links) }.to raise_error( RuntimeError, nats_err_msg ) @@ -386,7 +384,7 @@ describe 'when given a valid set of properties' do it 'renders the template' do - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } rendered_hash = JSON.parse(template.render(merged_manifest_properties, consumes: links)) expect(rendered_hash).to eq( 'host' => '192.168.0.0', @@ -426,7 +424,7 @@ describe 'when skip_ssl_validation is enabled' do before do merged_manifest_properties['route_registrar']['routing_api'] = { 'skip_ssl_validation' => true } - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } end it 'renders skip_ssl_validation as true' do @@ -438,7 +436,7 @@ describe 'when tls is enabled and the san is not provided' do before do merged_manifest_properties['route_registrar']['routes'][0].delete('server_cert_domain_san') - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } end it 'should required san if tls_port is provided' do expect { template.render(merged_manifest_properties, consumes: links) }.to raise_error( @@ -450,7 +448,7 @@ describe 'when tls is enabled and the san is not provided' do before do merged_manifest_properties['route_registrar']['routes'][0]['server_cert_domain_san'] = '' - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } end it 'should required san if tls_port is provided' do expect { template.render(merged_manifest_properties, consumes: links) }.to raise_error( @@ -463,7 +461,7 @@ before do merged_manifest_properties['route_registrar']['routes'][0].delete('tls_port') merged_manifest_properties['route_registrar']['routes'][0].delete('server_cert_domain_san') - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } end it 'renders the template' do @@ -473,7 +471,7 @@ describe 'when protocol is provided' do before do - merged_manifest_properties['nats'] = {'fail_if_using_nats_without_tls' => false } + merged_manifest_properties['nats'] = { 'fail_if_using_nats_without_tls' => false } end it 'uses configured protocol http1' do @@ -513,7 +511,7 @@ end context 'when properties and link is provided' do before do - merged_manifest_properties['nats'] = {"tls" => {"enabled" => true, "ca_cert" => 'the ca cert from properties'}} + merged_manifest_properties['nats'] = { 'tls' => { 'enabled' => true, 'ca_cert' => 'the ca cert from properties' } } end it 'should prefer the value in the properties' do rendered_template = template.render(merged_manifest_properties, consumes: links) @@ -528,7 +526,7 @@ end context 'when properties and no link is provided' do before do - merged_manifest_properties['nats'] = {"tls" => {"enabled" => true, "ca_cert" => 'the ca cert from properties'}} + merged_manifest_properties['nats'] = { 'tls' => { 'enabled' => true, 'ca_cert' => 'the ca cert from properties' } } end it 'should prefer the value in the properties' do @@ -546,6 +544,3 @@ end end end - -# rubocop: enable Layout/LineLength -# rubocop: enable Metrics/BlockLength diff --git a/spec/routing_api_templates_spec.rb b/spec/routing_api_templates_spec.rb index dc09ceb65..859153578 100644 --- a/spec/routing_api_templates_spec.rb +++ b/spec/routing_api_templates_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Layout/LineLength -# rubocop: disable Metrics/BlockLength require 'rspec' require 'bosh/template/test' require 'yaml' @@ -202,7 +200,8 @@ 'mtls_server_key_file' => '/var/vcap/jobs/routing-api/config/certs/routing-api/server.key' }, 'router_groups' => [], - 'reserved_system_component_ports' => [2_822, 2_825, 3_457, 3_458, 3_459, 3_460, 3_461, 8_853, 9_100, 14_726, 14_727, 14_821, 14_822, 14_823, 14_824, 14_829, 14_830, 14_920, 14_922, 15_821, 17_002, 53_035, 53_080], + 'reserved_system_component_ports' => [2_822, 2_825, 3_457, 3_458, 3_459, 3_460, 3_461, 8_853, 9_100, 14_726, 14_727, 14_821, 14_822, 14_823, 14_824, 14_829, + 14_830, 14_920, 14_922, 15_821, 17_002, 53_035, 53_080], 'sqldb' => { 'host' => 'host', 'port' => 1234, @@ -386,5 +385,3 @@ end end end -# rubocop: enable Layout/LineLength -# rubocop: enable Metrics/BlockLength diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8ec47e2e6..69fdce762 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Layout/LineLength -# rubocop:disable Metrics/BlockLength require 'rspec' require 'bosh/template/test' @@ -78,12 +76,8 @@ def delete_at_property(hash, property) end it 'should error' do - expect do - parsed_yaml - end.to raise_error( - RuntimeError, - "#{link_config.description} not found in properties nor in \"#{link_config.link_namespace}\" link. This value can be specified using the \"#{link_config.property}\" property." - ) + msg = "#{link_config.description} not found in properties nor in \"#{link_config.link_namespace}\" link. This value can be specified using the \"#{link_config.property}\" property." + expect { parsed_yaml }.to raise_error(RuntimeError, msg) end end end @@ -129,5 +123,3 @@ def make_properties(link, link_property) end end end -# rubocop: enable Layout/LineLength -# rubocop: enable Metrics/BlockLength diff --git a/spec/tcp_router_templates_spec.rb b/spec/tcp_router_templates_spec.rb index 96cf82710..a847fcfc4 100644 --- a/spec/tcp_router_templates_spec.rb +++ b/spec/tcp_router_templates_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# rubocop: disable Layout/LineLength -# rubocop: disable Metrics/BlockLength require 'rspec' require 'bosh/template/test' require 'yaml' @@ -58,7 +56,7 @@ template.render(merged_manifest_properties) end.to raise_error( RuntimeError, - "Please set tcp_router.tls_health_check_key in the tcp_router's job properties.", + "Please set tcp_router.tls_health_check_key in the tcp_router's job properties." ) end end @@ -71,7 +69,7 @@ template.render(merged_manifest_properties) end.to raise_error( RuntimeError, - "Please set tcp_router.tls_health_check_cert in the tcp_router's job properties.", + "Please set tcp_router.tls_health_check_cert in the tcp_router's job properties." ) end end @@ -379,5 +377,3 @@ end end end -# rubocop: enable Layout/LineLength -# rubocop: enable Metrics/BlockLength