Skip to content

Commit 06ccba3

Browse files
authored
Rename all occurences of least-connections (#4199)
1 parent b66529f commit 06ccba3

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

app/messages/route_options_message.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module VCAP::CloudController
44
class RouteOptionsMessage < BaseMessage
55
VALID_MANIFEST_ROUTE_OPTIONS = %i[loadbalancing].freeze
66
VALID_ROUTE_OPTIONS = %i[loadbalancing].freeze
7-
VALID_LOADBALANCING_ALGORITHMS = %w[round-robin least-connections].freeze
7+
VALID_LOADBALANCING_ALGORITHMS = %w[round-robin least-connection].freeze
88

99
register_allowed_keys VALID_ROUTE_OPTIONS
1010
validates_with NoAdditionalKeysValidator

docs/v3/source/includes/resources/routes/_route_options_object.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Example Route-Options object
99

1010
| Name | Type | Description |
1111
|-------------------|----------|------------------------------------------------------------------------------------------------------|
12-
| **loadbalancing** | _string_ | The load-balancer associated with this route. Valid values are 'round-robin' and 'least-connections' |
12+
| **loadbalancing** | _string_ | The load-balancer associated with this route. Valid values are 'round-robin' and 'least-connection' |

spec/request/space_manifests_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@
685685
'routes' => [
686686
{ 'route' => "https://#{route.host}.#{shared_domain.name}",
687687
'options' => {
688-
'loadbalancing' => 'least-connections'
688+
'loadbalancing' => 'least-connection'
689689
} }
690690
] }
691691
]
@@ -699,7 +699,7 @@
699699
Delayed::Worker.new.work_off
700700
expect(VCAP::CloudController::PollableJobModel.find(guid: job_guid)).to be_complete, VCAP::CloudController::PollableJobModel.find(guid: job_guid).cf_api_error
701701
app1_model.reload
702-
expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'least-connections' })
702+
expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'least-connection' })
703703
end
704704

705705
it 'does not modify any route options when the options hash is not provided' do
@@ -787,7 +787,7 @@
787787

788788
expect(last_response.status).to eq(422)
789789
expect(last_response).to have_error_message("For application '#{app1_model.name}': \
790-
Invalid value for 'loadbalancing' for Route 'https://#{route.host}.#{route.domain.name}'; Valid values are: 'round-robin, least-connections'")
790+
Invalid value for 'loadbalancing' for Route 'https://#{route.host}.#{route.domain.name}'; Valid values are: 'round-robin, least-connection'")
791791

792792
app1_model.reload
793793
expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' })
@@ -817,7 +817,7 @@
817817

818818
expect(last_response).to have_status_code(422)
819819
expect(last_response).to have_error_message("For application '#{app1_model.name}': \
820-
Cannot use loadbalancing value 'unsupported-lb-algorithm' for Route 'https://#{route.host}.#{route.domain.name}'; Valid values are: 'round-robin, least-connections'")
820+
Cannot use loadbalancing value 'unsupported-lb-algorithm' for Route 'https://#{route.host}.#{route.domain.name}'; Valid values are: 'round-robin, least-connection'")
821821
end
822822
end
823823

spec/unit/actions/route_update_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ module VCAP::CloudController
190190
let(:body) do
191191
{
192192
options: {
193-
loadbalancing: 'least-connections'
193+
loadbalancing: 'least-connection'
194194
}
195195
}
196196
end
@@ -200,7 +200,7 @@ module VCAP::CloudController
200200
subject.update(route:, message:)
201201
route.reload
202202

203-
expect(route.options).to include({ 'loadbalancing' => 'least-connections' })
203+
expect(route.options).to include({ 'loadbalancing' => 'least-connection' })
204204
end
205205
end
206206

spec/unit/messages/manifest_routes_update_message_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ module VCAP::CloudController
293293
msg = ManifestRoutesUpdateMessage.new(body)
294294

295295
expect(msg.valid?).to be(false)
296-
expect(msg.errors.full_messages).to include("Invalid value for 'loadbalancing' for Route 'existing.example.com'; Valid values are: 'round-robin, least-connections'")
296+
expect(msg.errors.full_messages).to include("Invalid value for 'loadbalancing' for Route 'existing.example.com'; Valid values are: 'round-robin, least-connection'")
297297
end
298298
end
299299

@@ -313,7 +313,7 @@ module VCAP::CloudController
313313

314314
expect(msg.valid?).to be(false)
315315
expect(msg.errors.errors.length).to eq(1)
316-
expect(msg.errors.full_messages).to include("Cannot use loadbalancing value 'sushi' for Route 'existing.example.com'; Valid values are: 'round-robin, least-connections'")
316+
expect(msg.errors.full_messages).to include("Cannot use loadbalancing value 'sushi' for Route 'existing.example.com'; Valid values are: 'round-robin, least-connection'")
317317
end
318318
end
319319
end

spec/unit/messages/route_create_message_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,15 +444,15 @@ module VCAP::CloudController
444444
expect(subject).to be_valid
445445
end
446446

447-
context 'when loadbalancing has value least-connections' do
447+
context 'when loadbalancing has value least-connection' do
448448
let(:params) do
449449
{
450450
host: 'some-host',
451451
relationships: {
452452
space: { data: { guid: 'space-guid' } },
453453
domain: { data: { guid: 'domain-guid' } }
454454
},
455-
options: { loadbalancing: 'least-connections' }
455+
options: { loadbalancing: 'least-connection' }
456456
}
457457
end
458458

@@ -492,7 +492,7 @@ module VCAP::CloudController
492492

493493
it 'is not valid' do
494494
expect(subject).not_to be_valid
495-
expect(subject.errors[:options]).to include("Loadbalancing must be one of 'round-robin, least-connections' if present")
495+
expect(subject.errors[:options]).to include("Loadbalancing must be one of 'round-robin, least-connection' if present")
496496
end
497497
end
498498
end

spec/unit/messages/route_update_message_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ module VCAP::CloudController
2828
expect(message).to be_valid
2929
end
3030

31-
it 'accepts options params with least-connections load-balancing algorithm' do
32-
message = RouteUpdateMessage.new(params.merge(options: { loadbalancing: 'least-connections' }))
31+
it 'accepts options params with least-connection load-balancing algorithm' do
32+
message = RouteUpdateMessage.new(params.merge(options: { loadbalancing: 'least-connection' }))
3333
expect(message).to be_valid
3434
end
3535

@@ -53,7 +53,7 @@ module VCAP::CloudController
5353
it 'does not accept unknown load-balancing algorithm' do
5454
message = RouteUpdateMessage.new(params.merge(options: { loadbalancing: 'cheesecake' }))
5555
expect(message).not_to be_valid
56-
expect(message.errors.full_messages[0]).to include("Options Loadbalancing must be one of 'round-robin, least-connections' if present")
56+
expect(message.errors.full_messages[0]).to include("Options Loadbalancing must be one of 'round-robin, least-connection' if present")
5757
end
5858

5959
it 'does not accept unknown option' do

spec/unit/messages/validators_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,8 @@ def options_message
545545
expect(message).to be_valid
546546
end
547547

548-
it 'successfully validates least-connections load-balancing algorithm' do
549-
message = OptionsMessage.new({ options: { loadbalancing: 'least-connections' } })
548+
it 'successfully validates least-connection load-balancing algorithm' do
549+
message = OptionsMessage.new({ options: { loadbalancing: 'least-connection' } })
550550
expect(message).to be_valid
551551
end
552552

@@ -575,7 +575,7 @@ def options_message
575575
it 'adds invalid load balancer error message to the base class' do
576576
message = OptionsMessage.new({ options: { loadbalancing: 'donuts' } })
577577
expect(message).not_to be_valid
578-
expect(message.errors_on(:options)).to include("Loadbalancing must be one of 'round-robin, least-connections' if present")
578+
expect(message.errors_on(:options)).to include("Loadbalancing must be one of 'round-robin, least-connection' if present")
579579
end
580580

581581
it 'adds invalid field error message to the base class' do

0 commit comments

Comments
 (0)