Skip to content

Commit 43c94ee

Browse files
authored
RUBY-3789 disambiguate spec test names (#3007)
The rest of this ticket was previously implemented as part of RUBY-3706
1 parent 8db6431 commit 43c94ee

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

lib/mongo/session.rb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def with_transaction(options = nil)
458458
overload_error_count = 0
459459
overload_encountered = false
460460

461-
loop do
461+
loop do # rubocop:disable Metrics/BlockLength
462462
if transaction_attempt > 0
463463
if overload_encountered
464464
delay = @client.retry_policy.backoff_delay(overload_error_count)
@@ -539,11 +539,10 @@ def with_transaction(options = nil)
539539
if deadline_expired?(deadline) ||
540540
(e.is_a?(Error::OperationFailure::Family) && e.max_time_ms_expired?)
541541
transaction_in_progress = false
542-
if @with_transaction_timeout_ms && deadline_expired?(deadline)
543-
make_timeout_error_from(e, 'CSOT timeout expired during withTransaction commit')
544-
else
545-
raise
546-
end
542+
543+
raise unless @with_transaction_timeout_ms && deadline_expired?(deadline)
544+
545+
make_timeout_error_from(e, 'CSOT timeout expired during withTransaction commit')
547546
end
548547

549548
if e.label?('SystemOverloadedError')
@@ -1401,12 +1400,9 @@ def backoff_would_exceed_deadline?(deadline, backoff_seconds)
14011400
# In CSOT mode raises TimeoutError with last_error's message included as a substring.
14021401
# In non-CSOT mode re-raises last_error directly.
14031402
def make_timeout_error_from(last_error, timeout_message)
1404-
if @with_transaction_timeout_ms
1405-
raise Mongo::Error::TimeoutError, "#{timeout_message}: #{last_error}"
1406-
else
1407-
raise last_error
1408-
end
1409-
end
1403+
raise Mongo::Error::TimeoutError, "#{timeout_message}: #{last_error}" if @with_transaction_timeout_ms
14101404

1405+
raise last_error
1406+
end
14111407
end
14121408
end

spec/spec_tests/data/client_backpressure/backpressure-retry-loop.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ tests:
366366
commandName: bulkWrite
367367

368368

369-
- description: 'database.aggregate retries using operation loop'
369+
- description: 'database.aggregate read retries using operation loop'
370370
operations:
371371
- name: failPoint
372372
object: testRunner
@@ -743,7 +743,7 @@ tests:
743743
commandName: aggregate
744744

745745

746-
- description: 'collection.aggregate retries using operation loop'
746+
- description: 'collection.aggregate read retries using operation loop'
747747
operations:
748748
- name: failPoint
749749
object: testRunner
@@ -2344,7 +2344,7 @@ tests:
23442344
commandName: dropIndexes
23452345

23462346

2347-
- description: 'collection.aggregate retries using operation loop'
2347+
- description: 'collection.aggregate write retries using operation loop'
23482348
operations:
23492349
- name: failPoint
23502350
object: testRunner

spec/spec_tests/data/client_backpressure/backpressure-retry-max-attempts.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ tests:
252252
- commandFailedEvent:
253253
commandName: bulkWrite
254254

255-
- description: 'database.aggregate retries at most maxAttempts=5 times'
255+
- description: 'database.aggregate read retries at most maxAttempts=5 times'
256256
operations:
257257
- name: failPoint
258258
object: testRunner
@@ -513,7 +513,7 @@ tests:
513513
- commandFailedEvent:
514514
commandName: aggregate
515515

516-
- description: 'collection.aggregate retries at most maxAttempts=5 times'
516+
- description: 'collection.aggregate read retries at most maxAttempts=5 times'
517517
operations:
518518
- name: failPoint
519519
object: testRunner
@@ -1711,7 +1711,7 @@ tests:
17111711
- commandFailedEvent:
17121712
commandName: dropIndexes
17131713

1714-
- description: 'collection.aggregate retries at most maxAttempts=5 times'
1714+
- description: 'collection.aggregate write retries at most maxAttempts=5 times'
17151715
operations:
17161716
- name: failPoint
17171717
object: testRunner

0 commit comments

Comments
 (0)