Skip to content
Merged
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
6 changes: 3 additions & 3 deletions spec/spec_tests/data/transactions/abort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ tests:
document:
_id: 1
result:
# Don't assert on errorCodeName because (after SERVER-38583) the
# DuplicateKey is reported in writeErrors, not as a top-level
# command error.
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
# DuplicateKey error code included in the bulk write error message
# returned by the server
errorContains: E11000
# Make sure the server aborted the transaction.
- name: insertOne
object: collection
Expand Down
6 changes: 3 additions & 3 deletions spec/spec_tests/data/transactions/error-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ tests:
- _id: 1
- _id: 1
result:
# Don't assert on errorCodeName because (after SERVER-38583) the
# DuplicateKey is reported in writeErrors, not as a top-level
# command error.
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
# DuplicateKey error code included in the bulk write error message
# returned by the server
errorContains: E11000
- name: abortTransaction
object: session0

Expand Down
6 changes: 3 additions & 3 deletions spec/spec_tests/data/transactions_api/callback-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ tests:
result:
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
result:
# Don't assert on errorCodeName because (after SERVER-38583) the
# DuplicateKey is reported in writeErrors, not as a top-level
# command error.
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
# DuplicateKey error code included in the bulk write error message
# returned by the server
errorContains: E11000
expectations:
-
command_started_event:
Expand Down
3 changes: 3 additions & 0 deletions spec/support/cluster_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def storage_engine
client = ClientRegistry.instance.global_client('root_authorized')
if topology == :sharded
shards = client.use(:admin).command(listShards: 1).first
if shards['shards'].empty?
raise 'Shards are empty'
end
shard = shards['shards'].first
address_str = shard['host'].sub(/^.*\//, '').sub(/,.*/, '')
client = ClusterTools.instance.direct_client(address_str,
Expand Down
2 changes: 1 addition & 1 deletion spec/support/transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def define_transactions_spec_tests(test_paths)

before do
if test.multiple_mongoses?
unless SpecConfig.instance.addresses.length > 1
if ClusterConfig.instance.topology == :sharded && SpecConfig.instance.addresses.length == 1
skip "Test requires multiple mongoses"
end
else
Expand Down