mongo 2.7.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +39 -14
- data/Rakefile +1 -0
- data/lib/mongo/auth.rb +4 -1
- data/lib/mongo/client.rb +4 -3
- data/lib/mongo/cluster.rb +1 -1
- data/lib/mongo/collection/view/readable.rb +5 -2
- data/lib/mongo/database.rb +1 -0
- data/lib/mongo/error/invalid_server_preference.rb +1 -0
- data/lib/mongo/error/operation_failure.rb +10 -0
- data/lib/mongo/error/parser.rb +10 -0
- data/lib/mongo/event.rb +1 -2
- data/lib/mongo/operation/result.rb +4 -1
- data/lib/mongo/operation/shared/executable_transaction_label.rb +3 -1
- data/lib/mongo/operation/shared/sessions_supported.rb +1 -1
- data/lib/mongo/protocol/msg.rb +1 -1
- data/lib/mongo/protocol/query.rb +2 -2
- data/lib/mongo/retryable.rb +20 -6
- data/lib/mongo/server.rb +6 -0
- data/lib/mongo/server/connection.rb +4 -4
- data/lib/mongo/server/monitor/connection.rb +9 -5
- data/lib/mongo/server_selector/selectable.rb +86 -32
- data/lib/mongo/session.rb +98 -15
- data/lib/mongo/version.rb +1 -1
- data/spec/README.md +85 -0
- data/spec/integration/bulk_insert_spec.rb +1 -1
- data/spec/integration/change_stream_examples_spec.rb +3 -1
- data/spec/integration/change_stream_spec.rb +10 -14
- data/spec/integration/client_construction_spec.rb +1 -0
- data/spec/integration/command_monitoring_spec.rb +37 -1
- data/spec/integration/command_spec.rb +141 -0
- data/spec/integration/connection_spec.rb +4 -2
- data/spec/integration/cursor_reaping_spec.rb +1 -1
- data/spec/integration/docs_examples_spec.rb +1 -1
- data/spec/integration/retryable_writes_spec.rb +33 -42
- data/spec/integration/server_description_spec.rb +3 -3
- data/spec/integration/server_selector_spec.rb +79 -0
- data/spec/lite_spec_helper.rb +4 -2
- data/spec/mongo/address_spec.rb +8 -0
- data/spec/mongo/auth/cr_spec.rb +5 -2
- data/spec/mongo/auth/invalid_mechanism_spec.rb +11 -0
- data/spec/mongo/auth/scram/conversation_spec.rb +3 -2
- data/spec/mongo/auth/scram/negotiation_spec.rb +1 -2
- data/spec/mongo/auth/scram_spec.rb +11 -6
- data/spec/mongo/auth/user/view_spec.rb +13 -6
- data/spec/mongo/bulk_write_spec.rb +81 -104
- data/spec/mongo/client_construction_spec.rb +18 -7
- data/spec/mongo/client_spec.rb +11 -7
- data/spec/mongo/cluster_spec.rb +30 -1
- data/spec/mongo/collection/view/aggregation_spec.rb +18 -10
- data/spec/mongo/collection/view/change_stream_spec.rb +28 -8
- data/spec/mongo/collection/view/map_reduce_spec.rb +24 -10
- data/spec/mongo/collection/view/readable_spec.rb +37 -19
- data/spec/mongo/collection/view/writable_spec.rb +64 -32
- data/spec/mongo/collection/view_spec.rb +4 -2
- data/spec/mongo/collection_spec.rb +163 -73
- data/spec/mongo/cursor_spec.rb +5 -2
- data/spec/mongo/database_spec.rb +41 -19
- data/spec/mongo/error/no_server_available_spec.rb +1 -1
- data/spec/mongo/error/parser_spec.rb +29 -0
- data/spec/mongo/grid/stream/write_spec.rb +2 -1
- data/spec/mongo/index/view_spec.rb +42 -24
- data/spec/mongo/operation/delete/op_msg_spec.rb +11 -7
- data/spec/mongo/operation/insert/op_msg_spec.rb +10 -6
- data/spec/mongo/operation/update/op_msg_spec.rb +10 -6
- data/spec/mongo/protocol/compressed_spec.rb +1 -1
- data/spec/mongo/protocol/msg_spec.rb +1 -1
- data/spec/mongo/server/app_metadata_spec.rb +2 -1
- data/spec/mongo/server/connection_auth_spec.rb +1 -1
- data/spec/mongo/server/monitor/connection_spec.rb +42 -0
- data/spec/mongo/server_selector_spec.rb +17 -0
- data/spec/mongo/server_spec.rb +110 -0
- data/spec/mongo/session/session_pool_spec.rb +1 -1
- data/spec/mongo/session_spec.rb +1 -1
- data/spec/mongo/session_transaction_spec.rb +162 -1
- data/spec/mongo/socket/ssl_spec.rb +14 -7
- data/spec/mongo/uri/srv_protocol_spec.rb +41 -34
- data/spec/spec_helper.rb +3 -191
- data/spec/spec_tests/change_streams_spec.rb +3 -6
- data/spec/spec_tests/data/transactions/abort.yml +3 -1
- data/spec/spec_tests/data/transactions/commit.yml +4 -3
- data/spec/spec_tests/data/transactions/error-labels.yml +17 -13
- data/spec/spec_tests/data/transactions/read-concern.yml +611 -0
- data/spec/spec_tests/data/transactions/retryable-commit.yml +126 -21
- data/spec/spec_tests/data/transactions_api/callback-aborts.yml +42 -39
- data/spec/spec_tests/data/transactions_api/callback-commits.yml +52 -50
- data/spec/spec_tests/data/transactions_api/callback-retry.yml +33 -31
- data/spec/spec_tests/data/transactions_api/commit-retry.yml +42 -39
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror-4.2.yml +13 -12
- data/spec/spec_tests/data/transactions_api/commit-transienttransactionerror.yml +15 -26
- data/spec/spec_tests/data/transactions_api/commit-writeconcernerror.yml +25 -33
- data/spec/spec_tests/data/transactions_api/commit.yml +44 -42
- data/spec/spec_tests/data/transactions_api/transaction-options.yml +25 -23
- data/spec/spec_tests/max_staleness_spec.rb +2 -0
- data/spec/spec_tests/retryable_writes_spec.rb +2 -6
- data/spec/spec_tests/sdam_spec.rb +2 -0
- data/spec/spec_tests/server_selection_spec.rb +3 -0
- data/spec/spec_tests/transactions_api_spec.rb +7 -1
- data/spec/spec_tests/transactions_spec.rb +6 -0
- data/spec/spec_tests/uri_options_spec.rb +4 -26
- data/spec/support/certificates/ca.pem +21 -16
- data/spec/support/certificates/client.pem +90 -90
- data/spec/support/certificates/client_cert.pem +21 -20
- data/spec/support/certificates/client_key.pem +27 -28
- data/spec/support/certificates/client_key_encrypted.pem +26 -26
- data/spec/support/certificates/crl.pem +10 -8
- data/spec/support/certificates/crl_client_revoked.pem +11 -10
- data/spec/support/certificates/server.pem +48 -33
- data/spec/support/change_streams.rb +12 -32
- data/spec/support/client_registry.rb +12 -1
- data/spec/support/cluster_config.rb +48 -2
- data/spec/support/common_shortcuts.rb +73 -7
- data/spec/support/connection_string.rb +0 -3
- data/spec/support/constraints.rb +87 -22
- data/spec/support/crud.rb +2 -1
- data/spec/support/shared/server_selector.rb +0 -28
- data/spec/support/shared/session.rb +25 -14
- data/spec/support/transactions.rb +4 -8
- data/spec/support/transactions/operation.rb +26 -4
- data/spec/support/transactions/verifier.rb +5 -2
- metadata +496 -488
- metadata.gz.sig +5 -2
- data/spec/support/certificates/password_protected.pem +0 -51
@@ -1,12 +1,78 @@
|
|
1
1
|
module CommonShortcuts
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
module ClassMethods
|
3
|
+
# Declares a topology double, which is configured to accept summary
|
4
|
+
# calls as those are used in SDAM event creation
|
5
|
+
def declare_topology_double
|
6
|
+
let(:topology) do
|
7
|
+
double('topology').tap do |topology|
|
8
|
+
allow(topology).to receive(:summary)
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
11
|
-
end
|
12
13
|
|
14
|
+
module InstanceMethods
|
15
|
+
def kill_all_server_sessions
|
16
|
+
begin
|
17
|
+
ClientRegistry.instance.global_client('root_authorized').command(killAllSessions: [])
|
18
|
+
# killAllSessions also kills the implicit session which the driver uses
|
19
|
+
# to send this command, as a result it always fails
|
20
|
+
rescue Mongo::Error::OperationFailure => e
|
21
|
+
# "operation was interrupted"
|
22
|
+
unless e.code == 11601
|
23
|
+
raise
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def wait_for_all_servers(cluster)
|
29
|
+
# Cluster waits for initial round of sdam until the primary
|
30
|
+
# is discovered, which means by the time a connection is obtained
|
31
|
+
# here some of the servers in the topology may still be unknown.
|
32
|
+
# This messes with event expectations below. Therefore, wait for
|
33
|
+
# all servers in the topology to be checked.
|
34
|
+
#
|
35
|
+
# This wait here assumes all addresses specified for the test
|
36
|
+
# suite are for working servers of the cluster; if this is not
|
37
|
+
# the case, this test will fail due to exceeding the general
|
38
|
+
# test timeout eventually.
|
39
|
+
while cluster.servers_list.any? { |server| server.unknown? }
|
40
|
+
warn "Waiting for unknown servers in #{cluster.servers}"
|
41
|
+
sleep 0.25
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def make_server(mode, options = {})
|
46
|
+
tags = options[:tags] || {}
|
47
|
+
average_round_trip_time = options[:average_round_trip_time] || 0
|
48
|
+
|
49
|
+
ismaster = {
|
50
|
+
'ismaster' => mode == :primary,
|
51
|
+
'secondary' => mode == :secondary,
|
52
|
+
'arbiterOnly' => mode == :arbiter,
|
53
|
+
'isreplicaset' => mode == :ghost,
|
54
|
+
'hidden' => mode == :other,
|
55
|
+
'tags' => tags,
|
56
|
+
'ok' => 1,
|
57
|
+
'minWireVersion' => 2, 'maxWireVersion' => 8,
|
58
|
+
}
|
59
|
+
if [:primary, :secondary, :arbiter, :other].include?(mode)
|
60
|
+
ismaster['setName'] = 'mongodb_set'
|
61
|
+
end
|
62
|
+
|
63
|
+
listeners = Mongo::Event::Listeners.new
|
64
|
+
monitoring = Mongo::Monitoring.new
|
65
|
+
address = options[:address]
|
66
|
+
|
67
|
+
cluster = double('cluster')
|
68
|
+
allow(cluster).to receive(:topology).and_return(topology)
|
69
|
+
allow(cluster).to receive(:app_metadata)
|
70
|
+
allow(cluster).to receive(:options).and_return({})
|
71
|
+
server = Mongo::Server.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
72
|
+
description = Mongo::Server::Description.new(address, ismaster, average_round_trip_time)
|
73
|
+
server.tap do |s|
|
74
|
+
allow(s).to receive(:description).and_return(description)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/spec/support/constraints.rb
CHANGED
@@ -23,27 +23,37 @@ module Constraints
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
26
|
+
def min_server_fcv(version)
|
27
|
+
unless version =~ /^\d+\.\d+$/
|
28
|
+
raise ArgumentError, "FCV can only be major.minor: #{version}"
|
29
|
+
end
|
30
|
+
|
31
|
+
before do
|
32
|
+
unless ClusterConfig.instance.fcv_ish >= version
|
33
|
+
skip "FCV #{version} or higher required, we have #{ClusterConfig.instance.fcv_ish} (server #{ClusterConfig.instance.server_version})"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def max_server_fcv(version)
|
39
|
+
unless version =~ /^\d+\.\d+$/
|
40
|
+
raise ArgumentError, "Version can only be major.minor: #{version}"
|
41
|
+
end
|
42
|
+
|
27
43
|
before do
|
28
|
-
|
29
|
-
skip
|
44
|
+
if version < ClusterConfig.instance.fcv_ish
|
45
|
+
skip "FCV #{version} or lower required, we have #{ClusterConfig.instance.fcv_ish} (server #{ClusterConfig.instance.server_version})"
|
30
46
|
end
|
31
47
|
end
|
32
48
|
end
|
33
49
|
|
34
50
|
def require_topology(*topologies)
|
35
|
-
|
36
|
-
invalid_topologies = topologies - %w(single replica_set sharded)
|
51
|
+
invalid_topologies = topologies - [:single, :replica_set, :sharded]
|
37
52
|
unless invalid_topologies.empty?
|
38
53
|
raise ArgumentError, "Invalid topologies requested: #{invalid_topologies.join(', ')}"
|
39
54
|
end
|
40
55
|
before do
|
41
|
-
topology =
|
42
|
-
topology = topology.gsub(/([A-Z])/) { |match| '_' + match.downcase }.sub(/^_/, '')
|
43
|
-
if topology =~ /^replica_set/
|
44
|
-
topology = 'replica_set'
|
45
|
-
end
|
46
|
-
unless topologies.include?(topology)
|
56
|
+
unless topologies.include?(topology = ClusterConfig.instance.topology)
|
47
57
|
skip "Topology #{topologies.join(' or ')} required, we have #{topology}"
|
48
58
|
end
|
49
59
|
end
|
@@ -51,32 +61,29 @@ module Constraints
|
|
51
61
|
|
52
62
|
def max_example_run_time(timeout)
|
53
63
|
around do |example|
|
54
|
-
TimeoutInterrupt.timeout(timeout) do
|
64
|
+
TimeoutInterrupt.timeout(timeout, TimeoutInterrupt::Error.new("Test execution terminated after #{timeout} seconds")) do
|
55
65
|
example.run
|
56
66
|
end
|
57
67
|
end
|
58
68
|
end
|
59
69
|
|
60
70
|
def require_transaction_support
|
61
|
-
|
71
|
+
min_server_fcv '4.0'
|
62
72
|
require_topology :replica_set
|
63
73
|
end
|
64
74
|
|
65
|
-
def
|
75
|
+
def require_ssl
|
66
76
|
before do
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
unless $mongo_server_features.scram_sha_256_enabled?
|
71
|
-
skip "SCRAM SHA 256 is not enabled on the server"
|
77
|
+
unless SpecConfig.instance.ssl?
|
78
|
+
skip "SSL not enabled"
|
72
79
|
end
|
73
80
|
end
|
74
81
|
end
|
75
82
|
|
76
|
-
def
|
83
|
+
def require_local_tls
|
77
84
|
before do
|
78
|
-
unless SpecConfig.instance.ssl?
|
79
|
-
skip
|
85
|
+
unless SpecConfig.instance.ssl? && !SpecConfig.instance.ci?
|
86
|
+
skip 'Not running locally with TLS enabled'
|
80
87
|
end
|
81
88
|
end
|
82
89
|
end
|
@@ -88,4 +95,62 @@ module Constraints
|
|
88
95
|
end
|
89
96
|
end
|
90
97
|
end
|
98
|
+
|
99
|
+
def require_compression
|
100
|
+
before do
|
101
|
+
if SpecConfig.instance.compressors.nil?
|
102
|
+
skip "Compression is not enabled"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def require_no_compression
|
108
|
+
before do
|
109
|
+
if SpecConfig.instance.compressors
|
110
|
+
skip "Compression is enabled"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def ruby_version_gte(version)
|
116
|
+
before do
|
117
|
+
if RUBY_VERSION < version
|
118
|
+
skip "Ruby version #{version} or higher required"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def ruby_version_lt(version)
|
124
|
+
before do
|
125
|
+
if RUBY_VERSION >= version
|
126
|
+
skip "Ruby version less than #{version} required"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def require_auth
|
132
|
+
before do
|
133
|
+
unless ENV['AUTH'] == 'auth' || ClusterConfig.instance.auth_enabled?
|
134
|
+
skip "Auth required"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def require_no_auth
|
140
|
+
before do
|
141
|
+
if ENV['AUTH'] == 'auth' || ClusterConfig.instance.auth_enabled?
|
142
|
+
skip "Auth not allowed"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Can the driver specify a write concern that won't be overridden?
|
148
|
+
# (mongos 4.0+ overrides the write concern)
|
149
|
+
def require_set_write_concern
|
150
|
+
before do
|
151
|
+
if ClusterConfig.instance.topology == :sharded && ClusterConfig.instance.short_server_version >= '4.0'
|
152
|
+
skip "mongos 4.0+ overrides write concern"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
91
156
|
end
|
data/spec/support/crud.rb
CHANGED
@@ -87,7 +87,8 @@ module Mongo
|
|
87
87
|
|
88
88
|
def lower_bound_satisfied?(client)
|
89
89
|
return true unless @min_server_version
|
90
|
-
|
90
|
+
#@min_server_version <= client.database.command(buildInfo: 1).first['version']
|
91
|
+
@min_server_version <= ClusterConfig.instance.fcv_ish
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|
@@ -1,31 +1,3 @@
|
|
1
|
-
def make_server(mode, options = {})
|
2
|
-
tags = options[:tags] || {}
|
3
|
-
average_round_trip_time = options[:average_round_trip_time] || 0
|
4
|
-
|
5
|
-
ismaster = {
|
6
|
-
'setName' => 'mongodb_set',
|
7
|
-
'ismaster' => mode == :primary,
|
8
|
-
'secondary' => mode != :primary,
|
9
|
-
'tags' => tags,
|
10
|
-
'ok' => 1,
|
11
|
-
'minWireVersion' => 2, 'maxWireVersion' => 8,
|
12
|
-
}
|
13
|
-
|
14
|
-
listeners = Mongo::Event::Listeners.new
|
15
|
-
monitoring = Mongo::Monitoring.new
|
16
|
-
address = options[:address]
|
17
|
-
|
18
|
-
cluster = double('cluster')
|
19
|
-
allow(cluster).to receive(:topology).and_return(topology)
|
20
|
-
allow(cluster).to receive(:app_metadata)
|
21
|
-
allow(cluster).to receive(:options).and_return({})
|
22
|
-
server = Mongo::Server.new(address, cluster, monitoring, listeners, SpecConfig.instance.test_options)
|
23
|
-
description = Mongo::Server::Description.new(address, ismaster, average_round_trip_time)
|
24
|
-
server.tap do |s|
|
25
|
-
allow(s).to receive(:description).and_return(description)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
1
|
shared_context 'server selector' do
|
30
2
|
|
31
3
|
let(:max_staleness) { nil }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
shared_examples 'an operation using a session' do
|
2
2
|
|
3
3
|
describe 'operation execution' do
|
4
|
-
|
4
|
+
min_server_fcv '3.6'
|
5
5
|
require_topology :replica_set, :sharded
|
6
6
|
|
7
7
|
context 'when the session is created from the same client used for the operation' do
|
@@ -86,7 +86,7 @@ end
|
|
86
86
|
shared_examples 'a failed operation using a session' do
|
87
87
|
|
88
88
|
context 'when the operation fails' do
|
89
|
-
|
89
|
+
min_server_fcv '3.6'
|
90
90
|
require_topology :replica_set, :sharded
|
91
91
|
|
92
92
|
let!(:before_last_use) do
|
@@ -127,7 +127,8 @@ shared_examples 'an explicit session with an unacknowledged write' do
|
|
127
127
|
EventSubscriber.clear_events!
|
128
128
|
end
|
129
129
|
|
130
|
-
context 'when sessions are supported'
|
130
|
+
context 'when sessions are supported' do
|
131
|
+
min_server_fcv '3.6'
|
131
132
|
|
132
133
|
let(:session) do
|
133
134
|
client.start_session
|
@@ -139,7 +140,8 @@ shared_examples 'an explicit session with an unacknowledged write' do
|
|
139
140
|
end
|
140
141
|
end
|
141
142
|
|
142
|
-
context 'when sessions are not supported'
|
143
|
+
context 'when sessions are not supported' do
|
144
|
+
min_server_fcv '3.6'
|
143
145
|
|
144
146
|
let(:session) do
|
145
147
|
double('session').tap do |s|
|
@@ -160,7 +162,8 @@ shared_examples 'an implicit session with an unacknowledged write' do
|
|
160
162
|
EventSubscriber.clear_events!
|
161
163
|
end
|
162
164
|
|
163
|
-
context 'when sessions are supported'
|
165
|
+
context 'when sessions are supported' do
|
166
|
+
min_server_fcv '3.6'
|
164
167
|
|
165
168
|
it 'does not add a session id to the operation' do
|
166
169
|
operation
|
@@ -168,7 +171,8 @@ shared_examples 'an implicit session with an unacknowledged write' do
|
|
168
171
|
end
|
169
172
|
end
|
170
173
|
|
171
|
-
context 'when sessions are not supported'
|
174
|
+
context 'when sessions are not supported' do
|
175
|
+
min_server_fcv '3.6'
|
172
176
|
|
173
177
|
it 'does not add a session id to the operation' do
|
174
178
|
operation
|
@@ -183,7 +187,9 @@ shared_examples 'an operation supporting causally consistent reads' do
|
|
183
187
|
subscribed_client
|
184
188
|
end
|
185
189
|
|
186
|
-
context 'when connected to a standalone'
|
190
|
+
context 'when connected to a standalone' do
|
191
|
+
min_server_fcv '3.6'
|
192
|
+
require_topology :single
|
187
193
|
|
188
194
|
context 'when the collection specifies a read concern' do
|
189
195
|
|
@@ -267,7 +273,7 @@ shared_examples 'an operation supporting causally consistent reads' do
|
|
267
273
|
end
|
268
274
|
|
269
275
|
context 'when connected to replica set or sharded cluster' do
|
270
|
-
|
276
|
+
min_server_fcv '3.6'
|
271
277
|
require_topology :replica_set, :sharded
|
272
278
|
|
273
279
|
context 'when the collection specifies a read concern' do
|
@@ -623,7 +629,7 @@ shared_examples 'an operation updating cluster time' do
|
|
623
629
|
context 'when the command is run once' do
|
624
630
|
|
625
631
|
context 'when the server is version 3.6' do
|
626
|
-
|
632
|
+
min_server_fcv '3.6'
|
627
633
|
|
628
634
|
context 'when the cluster is sharded or a replica set' do
|
629
635
|
require_topology :replica_set, :sharded
|
@@ -689,7 +695,7 @@ shared_examples 'an operation updating cluster time' do
|
|
689
695
|
end
|
690
696
|
|
691
697
|
context 'when the cluster is sharded or a replica set' do
|
692
|
-
|
698
|
+
min_server_fcv '3.6'
|
693
699
|
require_topology :replica_set, :sharded
|
694
700
|
|
695
701
|
context 'when the session cluster time is advanced' do
|
@@ -720,6 +726,8 @@ shared_examples 'an operation updating cluster time' do
|
|
720
726
|
context 'when the advanced cluster time is not greater than the existing cluster time' do
|
721
727
|
|
722
728
|
let(:advanced_cluster_time) do
|
729
|
+
expect(reply_cluster_time[Mongo::Cluster::CLUSTER_TIME].increment > 0).to be true
|
730
|
+
|
723
731
|
new_timestamp = BSON::Timestamp.new(reply_cluster_time[Mongo::Cluster::CLUSTER_TIME].seconds,
|
724
732
|
reply_cluster_time[Mongo::Cluster::CLUSTER_TIME].increment - 1)
|
725
733
|
new_cluster_time = reply_cluster_time.dup
|
@@ -746,7 +754,9 @@ shared_examples 'an operation updating cluster time' do
|
|
746
754
|
end
|
747
755
|
end
|
748
756
|
|
749
|
-
context 'when the server is a standalone'
|
757
|
+
context 'when the server is a standalone' do
|
758
|
+
min_server_fcv '3.6'
|
759
|
+
require_topology :single
|
750
760
|
|
751
761
|
let(:before_cluster_time) do
|
752
762
|
client.cluster.cluster_time
|
@@ -765,7 +775,8 @@ shared_examples 'an operation updating cluster time' do
|
|
765
775
|
end
|
766
776
|
end
|
767
777
|
|
768
|
-
context 'when the server is less than version 3.6'
|
778
|
+
context 'when the server is less than version 3.6' do
|
779
|
+
max_server_version '3.4'
|
769
780
|
|
770
781
|
let(:before_cluster_time) do
|
771
782
|
client.cluster.cluster_time
|
@@ -780,7 +791,7 @@ shared_examples 'an operation updating cluster time' do
|
|
780
791
|
end
|
781
792
|
|
782
793
|
shared_examples 'an operation not using a session' do
|
783
|
-
|
794
|
+
min_server_fcv '3.6'
|
784
795
|
|
785
796
|
describe 'operation execution' do
|
786
797
|
|
@@ -850,7 +861,7 @@ shared_examples 'an operation not using a session' do
|
|
850
861
|
end
|
851
862
|
|
852
863
|
shared_examples 'a failed operation not using a session' do
|
853
|
-
|
864
|
+
min_server_fcv '3.6'
|
854
865
|
|
855
866
|
context 'when the operation fails' do
|
856
867
|
|
@@ -61,11 +61,7 @@ module Mongo
|
|
61
61
|
# @since 2.6.0
|
62
62
|
def tests
|
63
63
|
@transaction_tests.map do |test|
|
64
|
-
|
65
|
-
nil
|
66
|
-
else
|
67
|
-
Proc.new { Mongo::Transactions::TransactionsTest.new(@data, test, self) }
|
68
|
-
end
|
64
|
+
Proc.new { Mongo::Transactions::TransactionsTest.new(@data, test, self) }
|
69
65
|
end.compact
|
70
66
|
end
|
71
67
|
|
@@ -100,6 +96,7 @@ module Mongo
|
|
100
96
|
attr_reader :expectations
|
101
97
|
|
102
98
|
attr_reader :expected_results
|
99
|
+
attr_reader :skip_reason
|
103
100
|
|
104
101
|
# Instantiate the new CRUDTest.
|
105
102
|
#
|
@@ -122,6 +119,7 @@ module Mongo
|
|
122
119
|
@fail_point = test['failPoint']
|
123
120
|
@operations = test['operations']
|
124
121
|
@expectations = test['expectations']
|
122
|
+
@skip_reason = test['skipReason']
|
125
123
|
@outcome = test['outcome']
|
126
124
|
@expected_results = @operations.map do |o|
|
127
125
|
result = o['result']
|
@@ -259,9 +257,7 @@ module Mongo
|
|
259
257
|
coll = support_client[@spec.collection_name]
|
260
258
|
coll.database.drop
|
261
259
|
coll.with(write: { w: :majority }).drop
|
262
|
-
support_client.command(
|
263
|
-
{ create: @spec.collection_name },
|
264
|
-
{ write_concern: { w: :majority } })
|
260
|
+
support_client.command(create: @spec.collection_name, writeConcern: { w: :majority })
|
265
261
|
|
266
262
|
coll.with(write: { w: :majority }).insert_many(@data) unless @data.empty?
|
267
263
|
admin_support_client.command(@fail_point) if @fail_point
|