Skip to content

Commit 585e1fb

Browse files
committed
fix rubocop complaints with sdam_prose_spec
1 parent 266a587 commit 585e1fb

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

.github/workflows/rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Rubocop
33

4-
on: [push, pull_request]
4+
on: [ push ]
55

66
jobs:
77
build:

spec/integration/sdam_prose_spec.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
end
6262
end
6363

64+
# rubocop:disable Naming/VariableName, RSpec/InstanceVariable
6465
describe 'Connection Pool Backpressure' do
6566
min_server_fcv '8.2'
6667
require_topology :single
@@ -72,8 +73,8 @@
7273
SpecConfig.instance.addresses,
7374
SpecConfig.instance.all_test_options.merge(
7475
max_connecting: 100,
75-
max_pool_size: 100,
76-
),
76+
max_pool_size: 100
77+
)
7778
).tap do |client|
7879
client.subscribe(Mongo::Monitoring::CONNECTION_POOL, subscriber)
7980
end
@@ -89,25 +90,25 @@
8990
defined?(@prev_ingressConnectionEstablishmentMaxQueueDepth)
9091
admin_db.command(
9192
setParameter: 1,
92-
ingressConnectionEstablishmentRateLimiterEnabled: @prev_ingressConnectionEstablishmentRateLimiterEnabled,
93+
ingressConnectionEstablishmentRateLimiterEnabled: @prev_ingressConnectionEstablishmentRateLimiterEnabled
9394
)
9495
admin_db.command(
9596
setParameter: 1,
96-
ingressConnectionEstablishmentRatePerSec: @prev_ingressConnectionEstablishmentRatePerSec,
97+
ingressConnectionEstablishmentRatePerSec: @prev_ingressConnectionEstablishmentRatePerSec
9798
)
9899
admin_db.command(
99100
setParameter: 1,
100-
ingressConnectionEstablishmentBurstCapacitySecs: @prev_ingressConnectionEstablishmentBurstCapacitySecs,
101+
ingressConnectionEstablishmentBurstCapacitySecs: @prev_ingressConnectionEstablishmentBurstCapacitySecs
101102
)
102103
admin_db.command(
103104
setParameter: 1,
104-
ingressConnectionEstablishmentMaxQueueDepth: @prev_ingressConnectionEstablishmentMaxQueueDepth,
105+
ingressConnectionEstablishmentMaxQueueDepth: @prev_ingressConnectionEstablishmentMaxQueueDepth
105106
)
106107
else
107108
# Fallback: at least disable the limiter if previous values were not captured.
108109
admin_db.command(
109110
setParameter: 1,
110-
ingressConnectionEstablishmentRateLimiterEnabled: false,
111+
ingressConnectionEstablishmentRateLimiterEnabled: false
111112
)
112113
end
113114
end
@@ -121,7 +122,7 @@
121122
ingressConnectionEstablishmentRateLimiterEnabled: 1,
122123
ingressConnectionEstablishmentRatePerSec: 1,
123124
ingressConnectionEstablishmentBurstCapacitySecs: 1,
124-
ingressConnectionEstablishmentMaxQueueDepth: 1,
125+
ingressConnectionEstablishmentMaxQueueDepth: 1
125126
).first
126127

127128
@prev_ingressConnectionEstablishmentRateLimiterEnabled =
@@ -136,35 +137,33 @@
136137
# Enable the ingress rate limiter with test-specific values.
137138
admin_db.command(
138139
setParameter: 1,
139-
ingressConnectionEstablishmentRateLimiterEnabled: true,
140+
ingressConnectionEstablishmentRateLimiterEnabled: true
140141
)
141142
admin_db.command(
142143
setParameter: 1,
143-
ingressConnectionEstablishmentRatePerSec: 20,
144+
ingressConnectionEstablishmentRatePerSec: 20
144145
)
145146
admin_db.command(
146147
setParameter: 1,
147-
ingressConnectionEstablishmentBurstCapacitySecs: 1,
148+
ingressConnectionEstablishmentBurstCapacitySecs: 1
148149
)
149150
admin_db.command(
150151
setParameter: 1,
151-
ingressConnectionEstablishmentMaxQueueDepth: 1,
152+
ingressConnectionEstablishmentMaxQueueDepth: 1
152153
)
153154

154155
# Add a document so $where has something to process.
155156
client.use('test')['test'].delete_many
156157
client.use('test')['test'].insert_one({})
157158

158159
# Run 100 parallel find_one operations that contend for connections.
159-
threads = 100.times.map do
160+
threads = Array.new(100) do
160161
Thread.new do
161-
begin
162-
client.use('test')['test'].find(
163-
'$where' => 'function() { sleep(2000); return true; }'
164-
).first
165-
rescue StandardError
166-
# Ignore connection errors (including checkout timeouts).
167-
end
162+
client.use('test')['test'].find(
163+
'$where' => 'function() { sleep(2000); return true; }'
164+
).first
165+
rescue StandardError
166+
# Ignore connection errors (including checkout timeouts).
168167
end
169168
end
170169
threads.each(&:join)
@@ -176,4 +175,5 @@
176175
expect(checkout_failed.length).to be >= 10
177176
end
178177
end
178+
# rubocop:enable Naming/VariableName, RSpec/InstanceVariable
179179
end

0 commit comments

Comments
 (0)