mongoid 7.6.1 → 7.6.3
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
- data/lib/config/locales/en.yml +26 -0
- data/lib/mongoid/association/depending.rb +8 -4
- data/lib/mongoid/association/nested/many.rb +38 -3
- data/lib/mongoid/association/nested/nested_buildable.rb +14 -0
- data/lib/mongoid/association/referenced/has_many/proxy.rb +105 -4
- data/lib/mongoid/attributes/readonly.rb +33 -3
- data/lib/mongoid/changeable.rb +22 -4
- data/lib/mongoid/config.rb +62 -0
- data/lib/mongoid/contextual/aggregable/memory.rb +8 -2
- data/lib/mongoid/contextual/memory.rb +19 -8
- data/lib/mongoid/contextual/none.rb +51 -0
- data/lib/mongoid/criteria/queryable/mergeable.rb +12 -0
- data/lib/mongoid/criteria/queryable/selectable.rb +124 -10
- data/lib/mongoid/criteria/scopable.rb +7 -1
- data/lib/mongoid/criteria.rb +45 -1
- data/lib/mongoid/document.rb +10 -0
- data/lib/mongoid/errors/in_memory_regexp_timeout.rb +26 -0
- data/lib/mongoid/errors.rb +1 -0
- data/lib/mongoid/field_readable.rb +70 -0
- data/lib/mongoid/matchable.rb +6 -1
- data/lib/mongoid/matcher/eq_impl_with_regexp.rb +3 -5
- data/lib/mongoid/matcher/regex.rb +8 -9
- data/lib/mongoid/matcher/regexp_budget.rb +389 -0
- data/lib/mongoid/matcher.rb +1 -0
- data/lib/mongoid/reloadable.rb +1 -0
- data/lib/mongoid/threaded.rb +3 -0
- data/lib/mongoid/version.rb +1 -1
- data/lib/mongoid/warnings.rb +1 -0
- data/spec/integration/app_spec.rb +8 -0
- data/spec/integration/matcher_operator_data/regex.yml +21 -0
- data/spec/integration/matcher_regexp_timeout_spec.rb +215 -0
- data/spec/integration/query_operator_guard_spec.rb +94 -0
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb +96 -0
- data/spec/mongoid/association/referenced/has_many/proxy_spec.rb +228 -0
- data/spec/mongoid/attributes/nested_spec.rb +202 -8
- data/spec/mongoid/attributes/readonly_dotted_spec.rb +286 -0
- data/spec/mongoid/attributes/readonly_spec.rb +387 -0
- data/spec/mongoid/changeable_spec.rb +18 -0
- data/spec/mongoid/contextual/aggregable/memory_spec.rb +98 -0
- data/spec/mongoid/contextual/memory_spec.rb +196 -0
- data/spec/mongoid/contextual/none_spec.rb +18 -0
- data/spec/mongoid/criteria/queryable/selectable_logical_spec.rb +29 -0
- data/spec/mongoid/criteria/queryable/selectable_where_spec.rb +200 -0
- data/spec/mongoid/criteria_spec.rb +19 -0
- data/spec/mongoid/findable_spec.rb +14 -0
- data/spec/mongoid/matcher/regexp_budget_spec.rb +576 -0
- data/spec/mongoid/scopable_spec.rb +116 -2
- data/spec/shared/lib/mrss/cluster_config.rb +5 -40
- data/spec/shared/lib/mrss/constraints.rb +7 -46
- data/spec/shared/lib/mrss/docker_runner.rb +10 -21
- data/spec/shared/lib/mrss/eg_config_utils.rb +0 -31
- data/spec/shared/lib/mrss/release/candidate.rb +18 -12
- data/spec/shared/lib/mrss/server_version_registry.rb +1 -5
- data/spec/shared/share/Dockerfile.erb +6 -8
- data/spec/shared/shlib/server.sh +0 -50
- data/spec/shared/shlib/set_env.sh +4 -10
- data/spec/spec_helper.rb +8 -0
- data/spec/support/models/delete_all_account.rb +10 -0
- data/spec/support/models/delete_all_item.rb +9 -0
- data/spec/support/models/delete_all_scoped_item.rb +11 -0
- data/spec/support/models/delete_all_tag.rb +7 -0
- metadata +1817 -1781
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
|
+
# Retrieve the singleton class for the given class.
|
|
6
|
+
def singleton_class_for(klass)
|
|
7
|
+
class <<klass; self; end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Helper method for removing a declared scope
|
|
11
|
+
def remove_scope(klass, scope)
|
|
12
|
+
if klass._declared_scopes[scope]
|
|
13
|
+
singleton_class_for(klass).remove_method(scope)
|
|
14
|
+
klass._declared_scopes.delete(scope)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
5
18
|
describe Mongoid::Scopable do
|
|
6
19
|
|
|
7
20
|
describe ".default_scope" do
|
|
@@ -111,9 +124,92 @@ describe Mongoid::Scopable do
|
|
|
111
124
|
end
|
|
112
125
|
end
|
|
113
126
|
|
|
114
|
-
context
|
|
127
|
+
context 'when the default scope is none' do
|
|
128
|
+
before do
|
|
129
|
+
Band.create!(name: 'Depeche Mode', active: true)
|
|
130
|
+
Band.default_scope -> { Band.none }
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
after do
|
|
134
|
+
Band.default_scoping = nil
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
it 'does not return any documents' do
|
|
138
|
+
expect(Band.count).to eq(0)
|
|
139
|
+
expect(Band.all.to_a).to be_empty
|
|
140
|
+
expect(Band.where(name: 'Depeche Mode').first).to be_nil
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it 'does not update documents' do
|
|
144
|
+
Band.update_all(active: false)
|
|
145
|
+
expect(Band.unscoped.first.active).to be(true)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it 'does not delete documents' do
|
|
149
|
+
expect(Band.delete_all).to eq(0)
|
|
150
|
+
expect(Band.unscoped.count).to eq(1)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it 'removes the none from the default scope when unscoping' do
|
|
154
|
+
crit = Band.all
|
|
155
|
+
expect(crit.count).to eq(0)
|
|
156
|
+
expect(crit.unscoped.count).to eq(1)
|
|
157
|
+
expect(Band.all.merge(Band.all).unscoped.count).to eq(1)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
it 'keeps an explicit none when unscoping' do
|
|
161
|
+
expect(Band.none.unscoped.count).to eq(0)
|
|
162
|
+
expect(Band.all.none.unscoped.count).to eq(0)
|
|
163
|
+
expect(Band.all.merge(Band.none).unscoped.count).to eq(0)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
context 'when the default scope is conditionally none' do
|
|
168
|
+
before do
|
|
169
|
+
Band.create!(name: 'Depeche Mode', active: true)
|
|
170
|
+
Band.default_scope -> { allow_all ? Band.where(active: true) : Band.none }
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
after do
|
|
174
|
+
Band.default_scoping = nil
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
context 'when the condition restricts the scope' do
|
|
178
|
+
let(:allow_all) { false }
|
|
179
|
+
|
|
180
|
+
it 'does not return any documents' do
|
|
181
|
+
expect(Band.count).to eq(0)
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
context 'when the condition allows all documents' do
|
|
186
|
+
let(:allow_all) { true }
|
|
187
|
+
|
|
188
|
+
it 'returns the documents' do
|
|
189
|
+
expect(Band.count).to eq(1)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
context 'when multiple default scopes are combined with none last' do
|
|
195
|
+
before do
|
|
196
|
+
Band.create!(name: 'Depeche Mode', active: true)
|
|
197
|
+
Band.default_scope -> { Band.where(active: true) }
|
|
198
|
+
Band.default_scope -> { Band.none }
|
|
199
|
+
end
|
|
115
200
|
|
|
116
|
-
|
|
201
|
+
after do
|
|
202
|
+
Band.default_scoping = nil
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
it 'does not return any documents' do
|
|
206
|
+
expect(Band.count).to eq(0)
|
|
207
|
+
expect(Band.all.to_a).to be_empty
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
context 'when parent class has default scope' do
|
|
212
|
+
let(:selector) do
|
|
117
213
|
AudibleSound.all.selector
|
|
118
214
|
end
|
|
119
215
|
|
|
@@ -882,6 +978,24 @@ describe Mongoid::Scopable do
|
|
|
882
978
|
expect(Circle.visible.selector).to eq("radius" => 5)
|
|
883
979
|
end
|
|
884
980
|
end
|
|
981
|
+
|
|
982
|
+
context 'when the scope name matches an internal criteria helper' do
|
|
983
|
+
before do
|
|
984
|
+
Band.scope(:none_state, -> { where(active: true) })
|
|
985
|
+
Band.scope(:clear_default_scope_none, -> { where(origin: 'England') })
|
|
986
|
+
end
|
|
987
|
+
|
|
988
|
+
after do
|
|
989
|
+
remove_scope(Band, :none_state)
|
|
990
|
+
remove_scope(Band, :clear_default_scope_none)
|
|
991
|
+
end
|
|
992
|
+
|
|
993
|
+
it 'applies both scopes when chained on a criteria' do
|
|
994
|
+
selector = Band.where(name: 'Depeche Mode').none_state.clear_default_scope_none.selector
|
|
995
|
+
|
|
996
|
+
expect(selector).to eq('name' => 'Depeche Mode', 'active' => true, 'origin' => 'England')
|
|
997
|
+
end
|
|
998
|
+
end
|
|
885
999
|
end
|
|
886
1000
|
|
|
887
1001
|
describe ".scoped" do
|
|
@@ -45,23 +45,16 @@ module Mrss
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# Per https://jira.mongodb.org/browse/SERVER-39052, working with FCV
|
|
48
|
-
# in sharded topologies is annoying.
|
|
49
|
-
# less than 3.4. This method returns FCV on 3.4+ servers when in single
|
|
48
|
+
# in sharded topologies is annoying. This method returns FCV when in single
|
|
50
49
|
# or RS topologies, and otherwise returns the major.minor server version.
|
|
51
50
|
def fcv_ish
|
|
52
51
|
if server_version.nil?
|
|
53
52
|
raise "Deployment server version not known - check that connection to deployment succeeded"
|
|
54
53
|
end
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if short_server_version == '4.1'
|
|
60
|
-
'4.2'
|
|
61
|
-
else
|
|
62
|
-
short_server_version
|
|
63
|
-
end
|
|
64
|
-
end
|
|
55
|
+
return fcv unless sharded_ish?
|
|
56
|
+
|
|
57
|
+
short_server_version
|
|
65
58
|
end
|
|
66
59
|
|
|
67
60
|
# @return [ Mongo::Address ] The address of the primary in the deployment.
|
|
@@ -113,34 +106,6 @@ module Mrss
|
|
|
113
106
|
@topology
|
|
114
107
|
end
|
|
115
108
|
|
|
116
|
-
def storage_engine
|
|
117
|
-
@storage_engine ||= begin
|
|
118
|
-
# 2.6 does not have wired tiger
|
|
119
|
-
if short_server_version == '2.6'
|
|
120
|
-
:mmapv1
|
|
121
|
-
else
|
|
122
|
-
client = ClientRegistry.instance.global_client('root_authorized')
|
|
123
|
-
if sharded_ish?
|
|
124
|
-
shards = client.use(:admin).command(listShards: 1).first
|
|
125
|
-
if shards['shards'].empty?
|
|
126
|
-
raise 'Shards are empty'
|
|
127
|
-
end
|
|
128
|
-
shard = shards['shards'].first
|
|
129
|
-
address_str = shard['host'].sub(/^.*\//, '').sub(/,.*/, '')
|
|
130
|
-
client = ClusterTools.instance.direct_client(address_str,
|
|
131
|
-
SpecConfig.instance.test_options.merge(SpecConfig.instance.auth_options).merge(connect: :direct))
|
|
132
|
-
end
|
|
133
|
-
rv = client.use(:admin).command(serverStatus: 1).first
|
|
134
|
-
rv = rv['storageEngine']['name']
|
|
135
|
-
rv_map = {
|
|
136
|
-
'wiredTiger' => :wired_tiger,
|
|
137
|
-
'mmapv1' => :mmapv1,
|
|
138
|
-
}
|
|
139
|
-
rv_map[rv] || rv
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
109
|
# This method returns an alternate address for connecting to the configured
|
|
145
110
|
# deployment. For example, if the replica set is configured with nodes at
|
|
146
111
|
# of localhost:27017 and so on, this method will return 127.0.0.:27017.
|
|
@@ -216,7 +181,7 @@ module Mrss
|
|
|
216
181
|
{}
|
|
217
182
|
end
|
|
218
183
|
|
|
219
|
-
|
|
184
|
+
unless sharded_ish?
|
|
220
185
|
rv = @server_parameters['featureCompatibilityVersion']
|
|
221
186
|
@fcv = rv['version'] || rv
|
|
222
187
|
end
|
|
@@ -69,22 +69,15 @@ module Mrss
|
|
|
69
69
|
before(:all) do
|
|
70
70
|
case ClusterConfig.instance.topology
|
|
71
71
|
when :single
|
|
72
|
-
skip 'Transactions tests require a replica set
|
|
73
|
-
when :replica_set
|
|
74
|
-
unless ClusterConfig.instance.server_version >= '4.0'
|
|
75
|
-
skip 'Transactions tests in a replica set topology require server 4.0+'
|
|
76
|
-
end
|
|
77
|
-
when :sharded, :load_balanced
|
|
78
|
-
unless ClusterConfig.instance.server_version >= '4.2'
|
|
79
|
-
skip 'Transactions tests in a sharded cluster topology require server 4.2+'
|
|
80
|
-
end
|
|
72
|
+
skip 'Transactions tests require a replica set or a sharded cluster'
|
|
73
|
+
when :replica_set, :sharded, :load_balanced
|
|
81
74
|
else
|
|
82
|
-
raise NotImplementedError
|
|
75
|
+
raise NotImplementedError, "Unknown topology #{ClusterConfig.instance.topology}"
|
|
83
76
|
end
|
|
84
77
|
end
|
|
85
78
|
end
|
|
86
79
|
|
|
87
|
-
# Fail command fail point
|
|
80
|
+
# Fail command fail point requires transactions to be supported
|
|
88
81
|
def require_fail_command
|
|
89
82
|
require_transaction_support
|
|
90
83
|
end
|
|
@@ -239,13 +232,11 @@ module Mrss
|
|
|
239
232
|
end
|
|
240
233
|
|
|
241
234
|
# Can the driver specify a write concern that won't be overridden?
|
|
242
|
-
# (mongos
|
|
235
|
+
# (mongos overrides the write concern)
|
|
243
236
|
def require_set_write_concern
|
|
244
237
|
before(:all) do
|
|
245
|
-
if %i(sharded load_balanced).include?(ClusterConfig.instance.topology)
|
|
246
|
-
|
|
247
|
-
then
|
|
248
|
-
skip "mongos 4.0+ overrides write concern"
|
|
238
|
+
if %i(sharded load_balanced).include?(ClusterConfig.instance.topology)
|
|
239
|
+
skip "mongos overrides write concern"
|
|
249
240
|
end
|
|
250
241
|
end
|
|
251
242
|
end
|
|
@@ -283,36 +274,6 @@ module Mrss
|
|
|
283
274
|
|
|
284
275
|
alias :require_no_multi_shard :require_no_multi_mongos
|
|
285
276
|
|
|
286
|
-
def require_wired_tiger
|
|
287
|
-
before(:all) do
|
|
288
|
-
# Storage detection fails for serverless instances. However, it is safe to
|
|
289
|
-
# assume that a serverless instance uses WiredTiger Storage Engine.
|
|
290
|
-
if !SpecConfig.instance.serverless? && ClusterConfig.instance.storage_engine != :wired_tiger
|
|
291
|
-
skip 'Test requires WiredTiger storage engine'
|
|
292
|
-
end
|
|
293
|
-
end
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
def require_wired_tiger_on_36
|
|
297
|
-
before(:all) do
|
|
298
|
-
if ClusterConfig.instance.short_server_version >= '3.6'
|
|
299
|
-
# Storage detection fails for serverless instances. However, it is safe to
|
|
300
|
-
# assume that a serverless instance uses WiredTiger Storage Engine.
|
|
301
|
-
if !SpecConfig.instance.serverless? && ClusterConfig.instance.storage_engine != :wired_tiger
|
|
302
|
-
skip 'Test requires WiredTiger storage engine on 3.6+ servers'
|
|
303
|
-
end
|
|
304
|
-
end
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
def require_mmapv1
|
|
309
|
-
before(:all) do
|
|
310
|
-
if SpecConfig.instance.serverless? || ClusterConfig.instance.storage_engine != :mmapv1
|
|
311
|
-
skip 'Test requires MMAPv1 storage engine'
|
|
312
|
-
end
|
|
313
|
-
end
|
|
314
|
-
end
|
|
315
|
-
|
|
316
277
|
def require_enterprise
|
|
317
278
|
before(:all) do
|
|
318
279
|
unless ClusterConfig.instance.enterprise?
|
|
@@ -84,12 +84,12 @@ module Mrss
|
|
|
84
84
|
arg.split('=', 2)
|
|
85
85
|
end]
|
|
86
86
|
|
|
87
|
-
@env['RVM_RUBY'] ||= 'ruby-2
|
|
87
|
+
@env['RVM_RUBY'] ||= 'ruby-3.2'
|
|
88
88
|
unless ruby =~ /^j?ruby-/
|
|
89
89
|
raise "RVM_RUBY option is not in expected format: #{ruby}"
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
@env['MONGODB_VERSION'] ||= '
|
|
92
|
+
@env['MONGODB_VERSION'] ||= '8.0'
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def create_dockerfile
|
|
@@ -178,12 +178,10 @@ module Mrss
|
|
|
178
178
|
|
|
179
179
|
def distro
|
|
180
180
|
@options[:distro] || if app_tests?
|
|
181
|
-
|
|
181
|
+
'ubuntu2004'
|
|
182
182
|
else
|
|
183
183
|
case server_version
|
|
184
|
-
when '
|
|
185
|
-
'debian9'
|
|
186
|
-
when '4.0', '4.2'
|
|
184
|
+
when '4.2'
|
|
187
185
|
'ubuntu1804'
|
|
188
186
|
else
|
|
189
187
|
'ubuntu2004'
|
|
@@ -192,18 +190,11 @@ module Mrss
|
|
|
192
190
|
end
|
|
193
191
|
|
|
194
192
|
BASE_IMAGES = {
|
|
195
|
-
'debian81' => 'debian:jessie',
|
|
196
|
-
'debian92' => 'debian:stretch',
|
|
197
|
-
'debian10' => 'debian:buster',
|
|
198
193
|
'debian11' => 'debian:bullseye',
|
|
199
|
-
'ubuntu1404' => 'ubuntu:trusty',
|
|
200
|
-
'ubuntu1604' => 'ubuntu:xenial',
|
|
201
194
|
'ubuntu1804' => 'ubuntu:bionic',
|
|
202
195
|
'ubuntu2004' => 'ubuntu:focal',
|
|
203
196
|
'ubuntu2204' => 'ubuntu:jammy',
|
|
204
|
-
'
|
|
205
|
-
'rhel70' => 'centos:7',
|
|
206
|
-
'rhel80' => 'rockylinux:8',
|
|
197
|
+
'ubuntu2404' => 'ubuntu:noble',
|
|
207
198
|
}.freeze
|
|
208
199
|
|
|
209
200
|
def base_image
|
|
@@ -256,14 +247,12 @@ module Mrss
|
|
|
256
247
|
|
|
257
248
|
def libmongocrypt_path
|
|
258
249
|
case distro
|
|
259
|
-
when /
|
|
260
|
-
"
|
|
261
|
-
when /
|
|
262
|
-
"
|
|
263
|
-
when /debian92/
|
|
264
|
-
"./debian92/nocrypto/lib64/libmongocrypt.so"
|
|
250
|
+
when /ubuntu..04/
|
|
251
|
+
"./#{distro}-64/nocrypto/lib64/libmongocrypt.so"
|
|
252
|
+
when /debian../
|
|
253
|
+
"./#{distro}/nocrypto/lib64/libmongocrypt.so"
|
|
265
254
|
else
|
|
266
|
-
raise "This script does not support running FLE tests on #{distro}.
|
|
255
|
+
raise "This script does not support running FLE tests on #{distro}."
|
|
267
256
|
end
|
|
268
257
|
end
|
|
269
258
|
|
|
@@ -5,37 +5,6 @@ require 'tilt'
|
|
|
5
5
|
|
|
6
6
|
module Mrss
|
|
7
7
|
module EgConfigUtils
|
|
8
|
-
|
|
9
|
-
DEBIAN_FOR_RUBY = {
|
|
10
|
-
'ruby-2.3' => 'debian92',
|
|
11
|
-
'ruby-2.4' => 'debian92',
|
|
12
|
-
'ruby-2.5' => 'debian10',
|
|
13
|
-
'ruby-2.6' => 'debian10',
|
|
14
|
-
'ruby-2.7' => 'debian10',
|
|
15
|
-
'ruby-3.0' => 'debian10',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
def standard_debian_rubies(rubies, key: nil, &block)
|
|
19
|
-
rubies.flatten!
|
|
20
|
-
text = block.call
|
|
21
|
-
contents = YAML.load(text)
|
|
22
|
-
out = rubies.map do |ruby|
|
|
23
|
-
contents.merge(
|
|
24
|
-
'matrix_name' => "#{contents['matrix_name']} - #{ruby}",
|
|
25
|
-
'matrix_spec' => contents['matrix_spec'].merge(
|
|
26
|
-
'ruby' => ruby,
|
|
27
|
-
key || 'os' => DEBIAN_FOR_RUBY.fetch(ruby),
|
|
28
|
-
),
|
|
29
|
-
)
|
|
30
|
-
end.to_yaml
|
|
31
|
-
text =~ /\A\n?(\s+)/
|
|
32
|
-
unless text
|
|
33
|
-
raise "Couldn't figure out indentation level"
|
|
34
|
-
end
|
|
35
|
-
indent = ' ' * ($1.length - 2)
|
|
36
|
-
"\n" + out.sub(/\A---.*\n/, indent).gsub("\n", "\n#{indent}")
|
|
37
|
-
end
|
|
38
|
-
|
|
39
8
|
def transform_config(template_path, context)
|
|
40
9
|
Tilt.new(template_path, engine_class: Erubi::CaptureEndEngine).render(context)
|
|
41
10
|
end
|
|
@@ -184,21 +184,27 @@ module Mrss
|
|
|
184
184
|
def extract_summary(pr)
|
|
185
185
|
summary = []
|
|
186
186
|
accumulating = false
|
|
187
|
+
in_code_block = false
|
|
187
188
|
level = nil
|
|
188
189
|
|
|
189
190
|
pr['body'].lines.each do |line|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
191
|
+
if !accumulating
|
|
192
|
+
# a header of any level titled "summary" will begin the summary
|
|
193
|
+
if line =~ /^(\#+)\s+summary\s+$/i
|
|
194
|
+
accumulating = true
|
|
195
|
+
level = $1.length
|
|
196
|
+
end
|
|
197
|
+
else
|
|
198
|
+
# if we encounter a code block, we don't let its contents affect our
|
|
199
|
+
# header-level counting (i.e. we don't want to accidentally end the
|
|
200
|
+
# summary just because there's a comment in a code block)
|
|
201
|
+
in_code_block = !in_code_block if line =~ /^```/
|
|
202
|
+
|
|
203
|
+
# a header of any level less than or equal to the summary header's
|
|
204
|
+
# level will end the summary
|
|
205
|
+
break if !in_code_block && line =~ /^\#{1,#{level}}\s+/
|
|
206
|
+
|
|
207
|
+
# otherwise, the line is part of the summary
|
|
202
208
|
summary << line
|
|
203
209
|
end
|
|
204
210
|
end
|
|
@@ -163,14 +163,12 @@ ENV DOCKER=1
|
|
|
163
163
|
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade --ignore-installed
|
|
164
164
|
<% end %>
|
|
165
165
|
|
|
166
|
-
# FLE
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0 'sqlalchemy<2.0.0'
|
|
173
|
-
<% end %>
|
|
166
|
+
# FLE requirements
|
|
167
|
+
# Requirements in drivers-evergreen-tools:
|
|
168
|
+
# boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
|
|
169
|
+
# cryptography does not install due to lacking setuptools_rust
|
|
170
|
+
# (either that version or anything that isn't part of system packages)
|
|
171
|
+
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0 'sqlalchemy<2.0.0'
|
|
174
172
|
|
|
175
173
|
<% unless ruby_head? || system_ruby? %>
|
|
176
174
|
|
data/spec/shared/shlib/server.sh
CHANGED
|
@@ -250,10 +250,6 @@ calculate_server_args() {
|
|
|
250
250
|
echo "Unknown topology: $TOPOLOGY" 1>&2
|
|
251
251
|
exit 1
|
|
252
252
|
fi
|
|
253
|
-
if test -n "$MMAPV1"; then
|
|
254
|
-
args="$args --storageEngine mmapv1 --smallfiles --noprealloc"
|
|
255
|
-
uri_options="$uri_options&retryReads=false&retryWrites=false"
|
|
256
|
-
fi
|
|
257
253
|
if test "$AUTH" = auth; then
|
|
258
254
|
args="$args --auth --username bob --password pwd123"
|
|
259
255
|
elif test "$AUTH" = x509; then
|
|
@@ -316,7 +312,6 @@ calculate_server_args() {
|
|
|
316
312
|
args="$args --bind_ip_all"
|
|
317
313
|
fi
|
|
318
314
|
|
|
319
|
-
# MongoDB servers pre-4.2 do not enable zlib compression by default
|
|
320
315
|
if test "$COMPRESSOR" = snappy; then
|
|
321
316
|
args="$args --networkMessageCompressors snappy"
|
|
322
317
|
elif test "$COMPRESSOR" = zlib; then
|
|
@@ -367,51 +362,6 @@ launch_server() {
|
|
|
367
362
|
local dbdir="$1"
|
|
368
363
|
python3 -m mtools.mlaunch.mlaunch --dir "$dbdir" --binarypath "$BINDIR" $SERVER_ARGS
|
|
369
364
|
|
|
370
|
-
if test "$TOPOLOGY" = sharded-cluster && test $MONGODB_VERSION = 3.6; then
|
|
371
|
-
# On 3.6 server the sessions collection is not immediately available,
|
|
372
|
-
# so we run the refreshLogicalSessionCacheNow command on the config server
|
|
373
|
-
# and again on each mongos in order for the mongoses
|
|
374
|
-
# to correctly report logicalSessionTimeoutMinutes.
|
|
375
|
-
mongos_regex="\s*mongos\s+([0-9]+)\s+running\s+[0-9]+"
|
|
376
|
-
config_server_regex="\s*config\sserver\s+([0-9]+)\s+running\s+[0-9]+"
|
|
377
|
-
config_server=""
|
|
378
|
-
mongoses=()
|
|
379
|
-
if test "$AUTH" = auth
|
|
380
|
-
then
|
|
381
|
-
base_url="mongodb://bob:pwd123@localhost"
|
|
382
|
-
else
|
|
383
|
-
base_url="mongodb://localhost"
|
|
384
|
-
fi
|
|
385
|
-
if test "$SSL" = "ssl"
|
|
386
|
-
then
|
|
387
|
-
mongo_command="${BINDIR}/mongo --ssl --sslPEMKeyFile $server_cert_path --sslCAFile $server_ca_path"
|
|
388
|
-
else
|
|
389
|
-
mongo_command="${BINDIR}/mongo"
|
|
390
|
-
fi
|
|
391
|
-
|
|
392
|
-
while read -r line
|
|
393
|
-
do
|
|
394
|
-
if [[ $line =~ $config_server_regex ]]
|
|
395
|
-
then
|
|
396
|
-
port="${BASH_REMATCH[1]}"
|
|
397
|
-
config_server="${base_url}:${port}"
|
|
398
|
-
fi
|
|
399
|
-
if [[ $line =~ $mongos_regex ]]
|
|
400
|
-
then
|
|
401
|
-
port="${BASH_REMATCH[1]}"
|
|
402
|
-
mongoses+=("${base_url}:${port}")
|
|
403
|
-
fi
|
|
404
|
-
done < <(python2 -m mtools.mlaunch.mlaunch list --dir "$dbdir" --binarypath "$BINDIR")
|
|
405
|
-
|
|
406
|
-
if [ -n "$config_server" ]; then
|
|
407
|
-
${mongo_command} "$config_server" --eval 'db.adminCommand("refreshLogicalSessionCacheNow")'
|
|
408
|
-
for mongos in ${mongoses[*]}
|
|
409
|
-
do
|
|
410
|
-
${mongo_command} "$mongos" --eval 'db.adminCommand("refreshLogicalSessionCacheNow")'
|
|
411
|
-
done
|
|
412
|
-
fi
|
|
413
|
-
fi
|
|
414
|
-
|
|
415
365
|
if test "$TOPOLOGY" = load-balanced; then
|
|
416
366
|
if test -z "$haproxy_config"; then
|
|
417
367
|
echo haproxy_config should have been set 1>&2
|
|
@@ -70,16 +70,10 @@ set_env_ruby() {
|
|
|
70
70
|
set_env_java
|
|
71
71
|
|
|
72
72
|
if [ "$RVM_RUBY" == "ruby-head" ]; then
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
#export PATH=/opt/python/3.7/bin:$PATH
|
|
78
|
-
|
|
79
|
-
# 12.04, 14.04 and 16.04 are good
|
|
80
|
-
curl --retry 3 -fL http://rubies.travis-ci.org/ubuntu/`lsb_release -rs`/x86_64/ruby-head.tar.bz2 |tar xfj -
|
|
81
|
-
# TODO adjust gem path?
|
|
82
|
-
export PATH=`pwd`/ruby-head/bin:`pwd`/ruby-head/lib/ruby/gems/2.6.0/bin:$PATH
|
|
73
|
+
# we could find a way to build ruby via rbenv here, perhaps?
|
|
74
|
+
echo 'ruby-head is not current supported'
|
|
75
|
+
exit 2
|
|
76
|
+
|
|
83
77
|
ruby --version
|
|
84
78
|
ruby --version |grep dev
|
|
85
79
|
elif test "$SYSTEM_RUBY" = 1; then
|
data/spec/spec_helper.rb
CHANGED
|
@@ -28,6 +28,14 @@ def database_id_alt
|
|
|
28
28
|
"mongoid_test_alt"
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
def test_model(name: 'TestModel', &block)
|
|
32
|
+
Class.new.tap do |klass|
|
|
33
|
+
klass.define_singleton_method(:name) { name.to_s }
|
|
34
|
+
klass.include Mongoid::Document
|
|
35
|
+
klass.class_eval(&block) if block_given?
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
31
39
|
begin
|
|
32
40
|
require 'mrss/cluster_config'
|
|
33
41
|
require 'support/client_registry'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class DeleteAllAccount
|
|
4
|
+
include Mongoid::Document
|
|
5
|
+
|
|
6
|
+
has_many :items, class_name: 'DeleteAllItem', foreign_key: :account_id, inverse_of: :account,
|
|
7
|
+
scope: -> { where(:state.in => %w[draft open]) }
|
|
8
|
+
has_many :scoped_items, class_name: 'DeleteAllScopedItem', foreign_key: :account_id, inverse_of: :account
|
|
9
|
+
has_and_belongs_to_many :tags, class_name: 'DeleteAllTag', inverse_of: nil
|
|
10
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class DeleteAllScopedItem
|
|
4
|
+
include Mongoid::Document
|
|
5
|
+
|
|
6
|
+
field :state, type: String
|
|
7
|
+
|
|
8
|
+
belongs_to :account, class_name: 'DeleteAllAccount', inverse_of: :scoped_items
|
|
9
|
+
|
|
10
|
+
default_scope -> { where(:state.in => %w[draft open]) }
|
|
11
|
+
end
|