mongoid 7.0.12 → 7.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,13 +57,22 @@ prepare_server_from_url() {
57
57
 
58
58
  install_mlaunch_virtualenv() {
59
59
  python2 -V || true
60
- # Current virtualenv fails with
61
- # https://github.com/pypa/virtualenv/issues/1630
62
- python -m pip install 'virtualenv<20' --user
63
- venvpath="$MONGO_ORCHESTRATION_HOME"/venv
64
- python2 -m virtualenv -p python2 $venvpath
65
- . $venvpath/bin/activate
66
- pip install 'mtools-legacy[mlaunch]'
60
+ if ! python2 -m virtualenv -h >/dev/null; then
61
+ # Current virtualenv fails with
62
+ # https://github.com/pypa/virtualenv/issues/1630
63
+ python2 -m pip install 'virtualenv<20' --user
64
+ fi
65
+ if test "$USE_SYSTEM_PYTHON_PACKAGES" = 1 &&
66
+ python2 -m pip list |grep mtools-legacy
67
+ then
68
+ # Use the existing mtools-legacy
69
+ :
70
+ else
71
+ venvpath="$MONGO_ORCHESTRATION_HOME"/venv
72
+ python2 -m virtualenv -p python2 $venvpath
73
+ . $venvpath/bin/activate
74
+ pip install 'mtools-legacy[mlaunch]'
75
+ fi
67
76
  }
68
77
 
69
78
  install_mlaunch_pip() {
@@ -126,11 +135,22 @@ install_mlaunch_git() {
126
135
 
127
136
  calculate_server_args() {
128
137
  local mongo_version=`echo $MONGODB_VERSION |tr -d .`
138
+
139
+ if test -z "$mongo_version"; then
140
+ echo "$MONGODB_VERSION must be set and not contain only dots" 1>&2
141
+ exit 3
142
+ fi
143
+
129
144
  if test $mongo_version = latest; then
130
- mongo_version=44
145
+ mongo_version=49
131
146
  fi
132
147
 
133
148
  local args="--setParameter enableTestCommands=1"
149
+
150
+ if test $mongo_version -ge 47; then
151
+ args="$args --setParameter acceptAPIVersion2=1"
152
+ fi
153
+
134
154
  # diagnosticDataCollectionEnabled is a mongod-only parameter on server 3.2,
135
155
  # and mlaunch does not support specifying mongod-only parameters:
136
156
  # https://github.com/rueckstiess/mtools/issues/696
@@ -143,7 +163,7 @@ calculate_server_args() {
143
163
  args="$args --replicaset --name ruby-driver-rs --nodes 2 --arbiter"
144
164
  export HAVE_ARBITER=1
145
165
  elif test "$TOPOLOGY" = sharded-cluster; then
146
- args="$args --replicaset --nodes 1 --sharded 1 --name ruby-driver-rs"
166
+ args="$args --replicaset --nodes 2 --sharded 1 --name ruby-driver-rs"
147
167
  if test -z "$SINGLE_MONGOS"; then
148
168
  args="$args --mongos 2"
149
169
  fi
data/spec/spec_helper.rb CHANGED
@@ -33,6 +33,7 @@ require 'support/expectations'
33
33
  require 'support/macros'
34
34
  require 'support/cluster_config'
35
35
  require 'support/constraints'
36
+ require 'mrss/constraints'
36
37
 
37
38
  # Give MongoDB time to start up on the travis ci environment.
38
39
  if (ENV['CI'] == 'travis' || ENV['CI'] == 'evergreen')
@@ -112,6 +113,7 @@ I18n.config.enforce_available_locales = false
112
113
  RSpec.configure do |config|
113
114
  config.raise_errors_for_deprecations!
114
115
  config.include(Mongoid::Expectations)
116
+ config.extend(Mrss::Constraints)
115
117
  config.extend(Constraints)
116
118
  config.extend(Mongoid::Macros)
117
119
 
@@ -43,230 +43,4 @@ module Constraints
43
43
  end
44
44
  end
45
45
  end
46
-
47
- def min_server_version(version)
48
- unless version =~ /\A\d+\.\d+\z/
49
- raise ArgumentError, "Version can only be major.minor: #{version}"
50
- end
51
-
52
- before(:all) do
53
- if version > ClusterConfig.instance.server_version
54
- skip "Server version #{version} or higher required, we have #{ClusterConfig.instance.server_version}"
55
- end
56
- end
57
- end
58
-
59
- def max_server_version(version)
60
- unless version =~ /\A\d+\.\d+\z/
61
- raise ArgumentError, "Version can only be major.minor: #{version}"
62
- end
63
-
64
- before(:all) do
65
- if version < ClusterConfig.instance.short_server_version
66
- skip "Server version #{version} or lower required, we have #{ClusterConfig.instance.server_version}"
67
- end
68
- end
69
- end
70
-
71
- def require_topology(*topologies)
72
- invalid_topologies = topologies - [:single, :replica_set, :sharded]
73
-
74
- unless invalid_topologies.empty?
75
- raise ArgumentError, "Invalid topologies requested: #{invalid_topologies.join(', ')}"
76
- end
77
-
78
- before(:all) do
79
- unless topologies.include?(topology = ClusterConfig.instance.topology)
80
- skip "Topology #{topologies.join(' or ')} required, we have #{topology}"
81
- end
82
- end
83
- end
84
-
85
- def max_example_run_time(timeout)
86
- around do |example|
87
- TimeoutInterrupt.timeout(timeout, TimeoutInterrupt::Error.new("Test execution terminated after #{timeout} seconds")) do
88
- example.run
89
- end
90
- end
91
- end
92
-
93
- def require_transaction_support
94
- before(:all) do
95
- case ClusterConfig.instance.topology
96
- when :single
97
- skip 'Transactions tests require a replica set (4.0+) or a sharded cluster (4.2+)'
98
- when :replica_set
99
- unless ClusterConfig.instance.server_version >= '4.0'
100
- skip 'Transactions tests in a replica set topology require server 4.0+'
101
- end
102
- when :sharded
103
- unless ClusterConfig.instance.server_version >= '4.2'
104
- skip 'Transactions tests in a sharded cluster topology require server 4.2+'
105
- end
106
- else
107
- raise NotImplementedError
108
- end
109
- end
110
- end
111
-
112
- def require_tls
113
- before(:all) do
114
- unless SpecConfig.instance.ssl?
115
- skip "SSL not enabled"
116
- end
117
- end
118
- end
119
-
120
- def require_no_tls
121
- before(:all) do
122
- if SpecConfig.instance.ssl?
123
- skip "SSL enabled"
124
- end
125
- end
126
- end
127
-
128
- def require_local_tls
129
- require_tls
130
- end
131
-
132
- def require_no_retry_writes
133
- before(:all) do
134
- if SpecConfig.instance.retry_writes?
135
- skip "Retry writes is enabled"
136
- end
137
- end
138
- end
139
-
140
- def require_compression
141
- before(:all) do
142
- if SpecConfig.instance.compressors.nil?
143
- skip "Compression is not enabled"
144
- end
145
- end
146
- end
147
-
148
- def require_no_compression
149
- before(:all) do
150
- if SpecConfig.instance.compressors
151
- skip "Compression is enabled"
152
- end
153
- end
154
- end
155
-
156
- def ruby_version_gte(version)
157
- before(:all) do
158
- if RUBY_VERSION < version
159
- skip "Ruby version #{version} or higher required"
160
- end
161
- end
162
- end
163
-
164
- def ruby_version_lt(version)
165
- before(:all) do
166
- if RUBY_VERSION >= version
167
- skip "Ruby version less than #{version} required"
168
- end
169
- end
170
- end
171
-
172
- def require_auth
173
- before(:all) do
174
- unless ENV['AUTH'] == 'auth' || SpecConfig.instance.user || ClusterConfig.instance.auth_enabled?
175
- skip "Auth required"
176
- end
177
- end
178
- end
179
-
180
- def require_no_auth
181
- before(:all) do
182
- if ENV['AUTH'] == 'auth' || SpecConfig.instance.user || ClusterConfig.instance.auth_enabled?
183
- skip "Auth not allowed"
184
- end
185
- end
186
- end
187
-
188
- def require_no_x509_auth
189
- before(:all) do
190
- if SpecConfig.instance.x509_auth?
191
- skip "X.509 auth not allowed"
192
- end
193
- end
194
- end
195
-
196
- # Can the driver specify a write concern that won't be overridden?
197
- # (mongos 4.0+ overrides the write concern)
198
- def require_set_write_concern
199
- before(:all) do
200
- if ClusterConfig.instance.topology == :sharded && ClusterConfig.instance.short_server_version >= '4.0'
201
- skip "mongos 4.0+ overrides write concern"
202
- end
203
- end
204
- end
205
-
206
- def require_multi_shard
207
- before(:all) do
208
- if ClusterConfig.instance.topology == :sharded && SpecConfig.instance.addresses.length == 1
209
- skip 'Test requires a minimum of two shards if run in sharded topology'
210
- end
211
- end
212
- end
213
-
214
- def require_no_multi_shard
215
- before(:all) do
216
- if ClusterConfig.instance.topology == :sharded && SpecConfig.instance.addresses.length > 1
217
- skip 'Test requires a single shard if run in sharded topology'
218
- end
219
- end
220
- end
221
-
222
- def require_wired_tiger
223
- before(:all) do
224
- if ClusterConfig.instance.storage_engine != :wired_tiger
225
- skip 'Test requires WiredTiger storage engine'
226
- end
227
- end
228
- end
229
-
230
- def require_wired_tiger_on_36
231
- before(:all) do
232
- if ClusterConfig.instance.short_server_version >= '3.6'
233
- if ClusterConfig.instance.storage_engine != :wired_tiger
234
- skip 'Test requires WiredTiger storage engine on 3.6+ servers'
235
- end
236
- end
237
- end
238
- end
239
-
240
- def require_mmapv1
241
- before(:all) do
242
- if ClusterConfig.instance.storage_engine != :mmapv1
243
- skip 'Test requires MMAPv1 storage engine'
244
- end
245
- end
246
- end
247
-
248
- def require_enterprise
249
- before(:all) do
250
- unless ClusterConfig.instance.enterprise?
251
- skip 'Test requires enterprise build of MongoDB'
252
- end
253
- end
254
- end
255
-
256
- # Integration tests for SRV polling require internet connectivity to
257
- # look up SRV records and a sharded cluster configured on default port on
258
- # localhost (localhost:27017, localhost:27018).
259
- def require_default_port_deployment
260
- # Because the DNS records at test1.test.build.10gen.cc point to
261
- # localhost:27017 & localhost:27018, the test suite must have been
262
- # configured to use these addresses
263
- before(:all) do
264
- have_default_port = SpecConfig.instance.addresses.any? do |address|
265
- %w(127.0.0.1 127.0.0.1:27017 localhost localhost:27017).include?(address)
266
- end
267
- unless have_default_port
268
- skip 'This test requires the test suite to be configured for localhost:27017'
269
- end
270
- end
271
- end
272
46
  end
@@ -44,4 +44,12 @@ class SpecConfig
44
44
  def ci?
45
45
  !!ENV['CI']
46
46
  end
47
+
48
+ def rails_version
49
+ v = ENV['RAILS']
50
+ if v == ''
51
+ v = nil
52
+ end
53
+ v || '6.1'
54
+ end
47
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.12
4
+ version: 7.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan
@@ -29,7 +29,7 @@ cert_chain:
29
29
  YoFhlyUEi7VLlqNH0H/JFttVZK6+qmLelkVNcIYVLeWOB4Lf4VxEiYGEK1ORxsrY
30
30
  iyYKJJALWY1FAInGRIlvkN+B8o3yIhq1
31
31
  -----END CERTIFICATE-----
32
- date: 2021-02-24 00:00:00.000000000 Z
32
+ date: 2021-05-08 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: activemodel
@@ -894,6 +894,7 @@ files:
894
894
  - spec/rails/controller_extension/controller_runtime_spec.rb
895
895
  - spec/rails/mongoid_spec.rb
896
896
  - spec/shared/LICENSE
897
+ - spec/shared/bin/get-mongodb-download-url
897
898
  - spec/shared/lib/mrss/child_process_helper.rb
898
899
  - spec/shared/lib/mrss/cluster_config.rb
899
900
  - spec/shared/lib/mrss/constraints.rb
@@ -901,13 +902,13 @@ files:
901
902
  - spec/shared/lib/mrss/lite_constraints.rb
902
903
  - spec/shared/lib/mrss/server_version_registry.rb
903
904
  - spec/shared/lib/mrss/spec_organizer.rb
905
+ - spec/shared/lib/mrss/utils.rb
904
906
  - spec/shared/share/Dockerfile.erb
905
907
  - spec/shared/shlib/distro.sh
906
908
  - spec/shared/shlib/server.sh
907
909
  - spec/shared/shlib/set_env.sh
908
910
  - spec/spec_helper.rb
909
911
  - spec/support/authorization.rb
910
- - spec/support/child_process_helper.rb
911
912
  - spec/support/cluster_config.rb
912
913
  - spec/support/constraints.rb
913
914
  - spec/support/expectations.rb
@@ -1222,11 +1223,13 @@ test_files:
1222
1223
  - spec/shared/lib/mrss/constraints.rb
1223
1224
  - spec/shared/lib/mrss/server_version_registry.rb
1224
1225
  - spec/shared/lib/mrss/docker_runner.rb
1226
+ - spec/shared/lib/mrss/utils.rb
1225
1227
  - spec/shared/lib/mrss/cluster_config.rb
1226
1228
  - spec/shared/lib/mrss/lite_constraints.rb
1227
1229
  - spec/shared/lib/mrss/child_process_helper.rb
1228
1230
  - spec/shared/lib/mrss/spec_organizer.rb
1229
1231
  - spec/shared/LICENSE
1232
+ - spec/shared/bin/get-mongodb-download-url
1230
1233
  - spec/shared/share/Dockerfile.erb
1231
1234
  - spec/README.md
1232
1235
  - spec/lite_spec_helper.rb
@@ -1237,7 +1240,6 @@ test_files:
1237
1240
  - spec/support/constraints.rb
1238
1241
  - spec/support/cluster_config.rb
1239
1242
  - spec/support/spec_config.rb
1240
- - spec/support/child_process_helper.rb
1241
1243
  - spec/app/models/contextable_item.rb
1242
1244
  - spec/app/models/alert.rb
1243
1245
  - spec/app/models/dragon.rb
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- ���?��^��7f�ރH0ﳷ����?���&h����#g����Z;kNF,Z _PA���Us3��M��Q4G4�|߫�_
2
- �Ci��6��Oa$�Q�xv���oy�:j��f �� �GI�Q�;�b�.>�&}����l-�k�( ȄT�"����Op%�2�D5��Fd�Iw#�NU�m�;�Vk&%�n����i���ak��r�����C��rh���'��ҫ� �T�^n�Q!��/�d
1
+ 0����f���f��-ٽLy_���M��c�R$Z-�js߁�v��D�-��./�ܱ��:loI�LSU�8 ���fs��8��o�N&1�_!��΋��G}-��F�>���8�h�ZC#\���C��"ܝ�i@�EwH�:1?H�]�l���hBc�IBlL#��ڎ��|��ONvVa�o�F{<N�!Q�RP��v�:��H�x_$�[�����I����m�e6a���A�3P<�ph)�9��E~�o ���r{f
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- autoload :ChildProcess, 'childprocess'
5
- autoload :Tempfile, 'tempfile'
6
-
7
- module ChildProcessHelper
8
- module_function def call(cmd, env: nil, cwd: nil)
9
- process = ChildProcess.new(*cmd)
10
- process.io.inherit!
11
- if cwd
12
- process.cwd = cwd
13
- end
14
- if env
15
- env.each do |k, v|
16
- process.environment[k.to_s] = v
17
- end
18
- end
19
- process.start
20
- process.wait
21
- process
22
- end
23
-
24
- module_function def check_call(cmd, env: nil, cwd: nil)
25
- process = call(cmd, env: env, cwd: cwd)
26
- unless process.exit_code == 0
27
- raise "Failed to execute: #{cmd}"
28
- end
29
- end
30
-
31
- module_function def get_output(cmd, env: nil, cwd: nil)
32
- process = ChildProcess.new(*cmd)
33
- process.io.inherit!
34
- if cwd
35
- process.cwd = cwd
36
- end
37
- if env
38
- env.each do |k, v|
39
- process.environment[k.to_s] = v
40
- end
41
- end
42
-
43
- output = ''
44
- r, w = IO.pipe
45
-
46
- begin
47
- process.io.stdout = w
48
- process.start
49
- w.close
50
-
51
- thread = Thread.new do
52
- begin
53
- loop do
54
- output << r.readpartial(16384)
55
- end
56
- rescue EOFError
57
- end
58
- end
59
-
60
- process.wait
61
- thread.join
62
- ensure
63
- r.close
64
- end
65
-
66
- [process, output]
67
- end
68
-
69
- module_function def check_output(*args)
70
- process, output = get_output(*args)
71
- unless process.exit_code == 0
72
- raise "Failed to execute: #{args}"
73
- end
74
- output
75
- end
76
- end