mongoid 9.0.0 → 9.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/Rakefile +44 -21
  4. data/lib/config/locales/en.yml +20 -0
  5. data/lib/mongoid/association/accessors.rb +7 -2
  6. data/lib/mongoid/association/nested/one.rb +14 -1
  7. data/lib/mongoid/association/referenced/belongs_to/binding.rb +7 -1
  8. data/lib/mongoid/association/referenced/belongs_to/buildable.rb +1 -1
  9. data/lib/mongoid/association/referenced/belongs_to.rb +15 -0
  10. data/lib/mongoid/association/referenced/has_many.rb +9 -8
  11. data/lib/mongoid/association/referenced/has_one/buildable.rb +3 -8
  12. data/lib/mongoid/association/referenced/with_polymorphic_criteria.rb +41 -0
  13. data/lib/mongoid/atomic_update_preparer.rb +7 -6
  14. data/lib/mongoid/attributes/nested.rb +2 -1
  15. data/lib/mongoid/clients/sessions.rb +12 -15
  16. data/lib/mongoid/composable.rb +2 -0
  17. data/lib/mongoid/config.rb +9 -0
  18. data/lib/mongoid/contextual/aggregable/memory.rb +3 -2
  19. data/lib/mongoid/contextual/aggregable/mongo.rb +5 -2
  20. data/lib/mongoid/criteria/findable.rb +2 -2
  21. data/lib/mongoid/criteria/queryable/extensions/numeric.rb +15 -1
  22. data/lib/mongoid/document.rb +2 -0
  23. data/lib/mongoid/errors/invalid_around_callback.rb +16 -0
  24. data/lib/mongoid/errors/unrecognized_model_alias.rb +53 -0
  25. data/lib/mongoid/errors/unrecognized_resolver.rb +27 -0
  26. data/lib/mongoid/errors/unregistered_class.rb +47 -0
  27. data/lib/mongoid/errors.rb +4 -0
  28. data/lib/mongoid/fields.rb +13 -7
  29. data/lib/mongoid/identifiable.rb +28 -0
  30. data/lib/mongoid/interceptable.rb +18 -13
  31. data/lib/mongoid/model_resolver.rb +154 -0
  32. data/lib/mongoid/persistence_context.rb +2 -1
  33. data/lib/mongoid/scopable.rb +7 -1
  34. data/lib/mongoid/touchable.rb +1 -7
  35. data/lib/mongoid/traversable.rb +5 -0
  36. data/lib/mongoid/version.rb +1 -1
  37. data/spec/integration/associations/belongs_to_spec.rb +129 -0
  38. data/spec/integration/persistence/collection_options_spec.rb +36 -0
  39. data/spec/mongoid/association/embedded/embeds_many_query_spec.rb +4 -0
  40. data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +1 -0
  41. data/spec/mongoid/association/referenced/belongs_to_spec.rb +58 -21
  42. data/spec/mongoid/association/referenced/has_many/buildable_spec.rb +4 -0
  43. data/spec/mongoid/association_spec.rb +14 -0
  44. data/spec/mongoid/attributes/nested_spec.rb +1 -0
  45. data/spec/mongoid/attributes_spec.rb +16 -0
  46. data/spec/mongoid/clients/transactions_spec.rb +2 -2
  47. data/spec/mongoid/contextual/aggregable/memory_spec.rb +11 -0
  48. data/spec/mongoid/contextual/aggregable/mongo_spec.rb +11 -0
  49. data/spec/mongoid/contextual/mongo_spec.rb +72 -3
  50. data/spec/mongoid/fields_spec.rb +2 -2
  51. data/spec/mongoid/interceptable_spec.rb +31 -0
  52. data/spec/mongoid/model_resolver_spec.rb +167 -0
  53. data/spec/mongoid/monkey_patches_spec.rb +1 -1
  54. data/spec/mongoid/persistence_context_spec.rb +17 -4
  55. data/spec/mongoid/scopable_spec.rb +88 -85
  56. data/spec/mongoid/serializable_spec.rb +16 -9
  57. data/spec/mongoid/touchable_spec.rb +75 -0
  58. data/spec/mongoid/touchable_spec_models.rb +16 -0
  59. data/spec/support/models/band.rb +1 -0
  60. data/spec/support/models/lat_lng.rb +6 -0
  61. metadata +20 -82
  62. checksums.yaml.gz.sig +0 -1
  63. data/spec/shared/LICENSE +0 -20
  64. data/spec/shared/bin/get-mongodb-download-url +0 -17
  65. data/spec/shared/bin/s3-copy +0 -45
  66. data/spec/shared/bin/s3-upload +0 -69
  67. data/spec/shared/lib/mrss/child_process_helper.rb +0 -80
  68. data/spec/shared/lib/mrss/cluster_config.rb +0 -231
  69. data/spec/shared/lib/mrss/constraints.rb +0 -378
  70. data/spec/shared/lib/mrss/docker_runner.rb +0 -298
  71. data/spec/shared/lib/mrss/eg_config_utils.rb +0 -51
  72. data/spec/shared/lib/mrss/event_subscriber.rb +0 -210
  73. data/spec/shared/lib/mrss/lite_constraints.rb +0 -238
  74. data/spec/shared/lib/mrss/server_version_registry.rb +0 -113
  75. data/spec/shared/lib/mrss/session_registry.rb +0 -69
  76. data/spec/shared/lib/mrss/session_registry_legacy.rb +0 -60
  77. data/spec/shared/lib/mrss/spec_organizer.rb +0 -179
  78. data/spec/shared/lib/mrss/utils.rb +0 -37
  79. data/spec/shared/share/Dockerfile.erb +0 -281
  80. data/spec/shared/share/haproxy-1.conf +0 -16
  81. data/spec/shared/share/haproxy-2.conf +0 -17
  82. data/spec/shared/shlib/config.sh +0 -27
  83. data/spec/shared/shlib/distro.sh +0 -74
  84. data/spec/shared/shlib/server.sh +0 -417
  85. data/spec/shared/shlib/set_env.sh +0 -146
  86. data.tar.gz.sig +0 -0
  87. metadata.gz.sig +0 -1
@@ -1,417 +0,0 @@
1
- # This file contains functions pertaining to downloading, starting and
2
- # configuring a MongoDB server.
3
-
4
- # Note that mlaunch is executed with (and therefore installed with) Python 2.
5
- # The reason for this is that in the past, some of the distros we tested on
6
- # had an ancient version of Python 3 that was unusable (e.g. it couldn't
7
- # install anything from PyPI due to outdated TLS/SSL implementation).
8
- # It is likely that all of the current distros we use have a recent enough
9
- # and working Python 3 implementation, such that we could use Python 3 for
10
- # everything.
11
- #
12
- # Note that some distros (e.g. ubuntu2004) do not contain a `python' binary
13
- # at all, thus python2 or python3 must be explicitly specified depending on
14
- # the desired version.
15
-
16
- set_fcv() {
17
- if test -n "$FCV"; then
18
- mongo --eval 'assert.commandWorked(db.adminCommand( { setFeatureCompatibilityVersion: "'"$FCV"'" } ));' "$MONGODB_URI"
19
- mongo --quiet --eval 'db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )' |grep "version.*$FCV"
20
- fi
21
- }
22
-
23
- add_uri_option() {
24
- opt=$1
25
-
26
- if ! echo $MONGODB_URI |sed -e s,//,, |grep -q /; then
27
- MONGODB_URI="$MONGODB_URI/"
28
- fi
29
-
30
- if ! echo $MONGODB_URI |grep -q '?'; then
31
- MONGODB_URI="$MONGODB_URI?"
32
- fi
33
-
34
- MONGODB_URI="$MONGODB_URI&$opt"
35
- }
36
-
37
- prepare_server() {
38
- arch=$1
39
-
40
- if test -n "$USE_OPT_MONGODB"; then
41
- export BINDIR=/opt/mongodb/bin
42
- export PATH=$BINDIR:$PATH
43
- return
44
- fi
45
-
46
- if test "$MONGODB_VERSION" = latest; then
47
- # Test on the most recent published 4.3 release.
48
- # https://jira.mongodb.org/browse/RUBY-1724
49
-
50
- . $PROJECT_DIRECTORY/.mod/drivers-evergreen-tools/.evergreen/download-mongodb.sh
51
-
52
- get_distro
53
- get_mongodb_download_url_for "$DISTRO" "latest"
54
- prepare_server_from_url $MONGODB_DOWNLOAD_URL
55
- else
56
- download_version="$MONGODB_VERSION"
57
- url=`$(dirname $0)/get-mongodb-download-url $download_version $arch`
58
- prepare_server_from_url $url
59
- fi
60
-
61
- }
62
-
63
- prepare_server_from_url() {
64
- url=$1
65
-
66
- dirname=`basename $url |sed -e s/.tgz//`
67
- mongodb_dir="$MONGO_ORCHESTRATION_HOME"/mdb/"$dirname"
68
- mkdir -p "$mongodb_dir"
69
- curl --retry 3 $url | tar xz -C "$mongodb_dir" --strip-components 1 -f -
70
- BINDIR="$mongodb_dir"/bin
71
- export PATH="$BINDIR":$PATH
72
- }
73
-
74
- install_mlaunch_venv() {
75
- python3 -V || true
76
- if ! python3 -m venv -h >/dev/null; then
77
- # Current virtualenv fails with
78
- # https://github.com/pypa/virtualenv/issues/1630
79
- python3 -m pip install venv --user
80
- fi
81
- if ! python3 -m ensurepip -h > /dev/null; then
82
- # Debian11/Ubuntu2204 have venv installed, but it is nonfunctional unless
83
- # the python3-venv package is also installed (it lacks the ensurepip
84
- # module).
85
- sudo apt-get install --yes python3-venv
86
- fi
87
- if test "$USE_SYSTEM_PYTHON_PACKAGES" = 1 &&
88
- python3 -m pip list |grep mtools
89
- then
90
- # Use the existing mtools-legacy
91
- :
92
- else
93
- # Spawn a virtual environment, but only if one is not already
94
- # active...
95
- if test -z "$VIRTUAL_ENV"; then
96
- venvpath="$MONGO_ORCHESTRATION_HOME"/venv
97
- python3 -m venv $venvpath
98
- . $venvpath/bin/activate
99
- fi
100
-
101
- # [mlaunch] does not work:
102
- # https://github.com/rueckstiess/mtools/issues/856
103
- # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
104
- #pip install 'mtools==1.7' 'pymongo==4.1' python-dateutil psutil
105
-
106
- # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
107
- pip install --upgrade setuptools
108
- pip install 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
109
- fi
110
- }
111
-
112
- install_mlaunch_pip() {
113
- if test -n "$USE_OPT_MONGODB" && which mlaunch >/dev/null 2>&1; then
114
- # mlaunch is preinstalled in the docker image, do not install it here
115
- return
116
- fi
117
-
118
- python -V || true
119
- python3 -V || true
120
- pythonpath="$MONGO_ORCHESTRATION_HOME"/python
121
- # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
122
- pip install -t "$pythonpath" 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
123
- export PATH="$pythonpath/bin":$PATH
124
- export PYTHONPATH="$pythonpath"
125
- }
126
-
127
- install_mlaunch_git() {
128
- repo=$1
129
- branch=$2
130
- python -V || true
131
- python3 -V || true
132
- which pip || true
133
- which pip3 || true
134
-
135
- if false; then
136
- if ! virtualenv --version; then
137
- python3 `which pip3` install --user virtualenv
138
- export PATH=$HOME/.local/bin:$PATH
139
- virtualenv --version
140
- fi
141
-
142
- venvpath="$MONGO_ORCHESTRATION_HOME"/venv
143
- virtualenv -p python3 $venvpath
144
- . $venvpath/bin/activate
145
-
146
- # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
147
- pip3 install psutil pymongo python-dateutil
148
-
149
- git clone $repo mlaunch
150
- cd mlaunch
151
- git checkout origin/$branch
152
- python3 setup.py install
153
- cd ..
154
- else
155
- pip install --user 'virtualenv==13'
156
- export PATH=$HOME/.local/bin:$PATH
157
-
158
- venvpath="$MONGO_ORCHESTRATION_HOME"/venv
159
- virtualenv $venvpath
160
- . $venvpath/bin/activate
161
-
162
- # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
163
- pip install psutil pymongo python-dateutil
164
-
165
- git clone $repo mlaunch
166
- (cd mlaunch &&
167
- git checkout origin/$branch &&
168
- python2 setup.py install
169
- )
170
- fi
171
- }
172
-
173
- install_cmake() {
174
- if ! command -v cmake &> /dev/null; then
175
- if ! command -v apt-get &> /dev/null; then
176
- # no apt-get; assume RHEL
177
- sudo yum -y install cmake libarchive
178
- else
179
- sudo apt-get install --yes cmake
180
- fi
181
- else
182
- echo 'cmake is present'
183
- fi
184
- }
185
-
186
- # This function sets followong global variables:
187
- # server_cert_path
188
- # server_ca_path
189
- # server_client_cert_path
190
- #
191
- # These variables are used later to connect to processes via mongo client.
192
- calculate_server_args() {
193
- local mongo_version=`echo $MONGODB_VERSION |tr -d .`
194
-
195
- if test -z "$mongo_version"; then
196
- echo "$MONGODB_VERSION must be set and not contain only dots" 1>&2
197
- exit 3
198
- fi
199
-
200
- if test $mongo_version = latest; then
201
- mongo_version=70
202
- fi
203
-
204
- local args="--setParameter enableTestCommands=1"
205
-
206
- if test $mongo_version -ge 50; then
207
- args="$args --setParameter acceptApiVersion2=1"
208
- elif test $mongo_version -ge 47; then
209
- args="$args --setParameter acceptAPIVersion2=1"
210
- fi
211
-
212
- # diagnosticDataCollectionEnabled is a mongod-only parameter on server 3.2,
213
- # and mlaunch does not support specifying mongod-only parameters:
214
- # https://github.com/rueckstiess/mtools/issues/696
215
- # Pass it to 3.4 and newer servers where it is accepted by all daemons.
216
- if test $mongo_version -ge 34; then
217
- args="$args --setParameter diagnosticDataCollectionEnabled=false"
218
- fi
219
- local uri_options=
220
- if test "$TOPOLOGY" = replica-set; then
221
- args="$args --replicaset --name test-rs --nodes 2 --arbiter"
222
- export HAVE_ARBITER=1
223
- elif test "$TOPOLOGY" = sharded-cluster; then
224
- args="$args --replicaset --nodes 2 --sharded 1 --name test-rs"
225
- if test -z "$SINGLE_MONGOS"; then
226
- args="$args --mongos 2"
227
- fi
228
- elif test "$TOPOLOGY" = standalone; then
229
- args="$args --single"
230
- elif test "$TOPOLOGY" = load-balanced; then
231
- args="$args --replicaset --nodes 2 --sharded 1 --name test-rs --port 27117"
232
- if test -z "$MRSS_ROOT"; then
233
- echo "Please set MRSS_ROOT" 1>&2
234
- exit 2
235
- fi
236
- if test -n "$SINGLE_MONGOS"; then
237
- haproxy_config=$MRSS_ROOT/share/haproxy-1.conf
238
- else
239
- args="$args --mongos 2"
240
- haproxy_config=$MRSS_ROOT/share/haproxy-2.conf
241
- fi
242
- uri_options="$uri_options&loadBalanced=true"
243
- else
244
- echo "Unknown topology: $TOPOLOGY" 1>&2
245
- exit 1
246
- fi
247
- if test -n "$MMAPV1"; then
248
- args="$args --storageEngine mmapv1 --smallfiles --noprealloc"
249
- uri_options="$uri_options&retryReads=false&retryWrites=false"
250
- fi
251
- if test "$AUTH" = auth; then
252
- args="$args --auth --username bob --password pwd123"
253
- elif test "$AUTH" = x509; then
254
- args="$args --auth --username bootstrap --password bootstrap"
255
- elif echo "$AUTH" |grep -q ^aws; then
256
- args="$args --auth --username bootstrap --password bootstrap"
257
- args="$args --setParameter authenticationMechanisms=MONGODB-AWS,SCRAM-SHA-1,SCRAM-SHA-256"
258
- uri_options="$uri_options&authMechanism=MONGODB-AWS&authSource=\$external"
259
- fi
260
-
261
- if test -n "$OCSP"; then
262
- if test -z "$OCSP_ALGORITHM"; then
263
- echo "OCSP_ALGORITHM must be set if OCSP is set" 1>&2
264
- exit 1
265
- fi
266
- fi
267
-
268
- if test "$SSL" = ssl || test -n "$OCSP_ALGORITHM"; then
269
- if test -n "$OCSP_ALGORITHM"; then
270
- if test "$OCSP_MUST_STAPLE" = 1; then
271
- server_cert_path=spec/support/ocsp/$OCSP_ALGORITHM/server-mustStaple.pem
272
- else
273
- server_cert_path=spec/support/ocsp/$OCSP_ALGORITHM/server.pem
274
- fi
275
- server_ca_path=spec/support/ocsp/$OCSP_ALGORITHM/ca.crt
276
- server_client_cert_path=spec/support/ocsp/$OCSP_ALGORITHM/server.pem
277
- else
278
- server_cert_path=spec/support/certificates/server-second-level-bundle.pem
279
- server_ca_path=spec/support/certificates/ca.crt
280
- server_client_cert_path=spec/support/certificates/client.pem
281
- fi
282
-
283
- if test -n "$OCSP_ALGORITHM"; then
284
- client_cert_path=spec/support/ocsp/$OCSP_ALGORITHM/server.pem
285
- elif test "$AUTH" = x509; then
286
- client_cert_path=spec/support/certificates/client-x509.pem
287
-
288
- uri_options="$uri_options&authMechanism=MONGODB-X509"
289
- elif echo $RVM_RUBY |grep -q jruby; then
290
- # JRuby does not grok chained certificate bundles -
291
- # https://github.com/jruby/jruby-openssl/issues/181
292
- client_cert_path=spec/support/certificates/client.pem
293
- else
294
- client_cert_path=spec/support/certificates/client-second-level-bundle.pem
295
- fi
296
-
297
- uri_options="$uri_options&tls=true&"\
298
- "tlsCAFile=$server_ca_path&"\
299
- "tlsCertificateKeyFile=$client_cert_path"
300
-
301
- args="$args --sslMode requireSSL"\
302
- " --sslPEMKeyFile $server_cert_path"\
303
- " --sslCAFile $server_ca_path"\
304
- " --sslClientCertificate $server_client_cert_path"
305
- fi
306
-
307
- # Docker forwards ports to the external interface, not to the loopback.
308
- # Hence we must bind to all interfaces here.
309
- if test -n "$BIND_ALL"; then
310
- args="$args --bind_ip_all"
311
- fi
312
-
313
- # MongoDB servers pre-4.2 do not enable zlib compression by default
314
- if test "$COMPRESSOR" = snappy; then
315
- args="$args --networkMessageCompressors snappy"
316
- elif test "$COMPRESSOR" = zlib; then
317
- args="$args --networkMessageCompressors zlib"
318
- fi
319
-
320
- if test -n "$OCSP_ALGORITHM" || test -n "$OCSP_VERIFIER"; then
321
- python3 -m pip install asn1crypto oscrypto flask
322
- fi
323
-
324
- local ocsp_args=
325
- if test -n "$OCSP_ALGORITHM"; then
326
- if test -z "$server_ca_path"; then
327
- echo "server_ca_path must have been set" 1>&2
328
- exit 1
329
- fi
330
- ocsp_args="--ca_file $server_ca_path"
331
- if test "$OCSP_DELEGATE" = 1; then
332
- ocsp_args="$ocsp_args \
333
- --ocsp_responder_cert spec/support/ocsp/$OCSP_ALGORITHM/ocsp-responder.crt \
334
- --ocsp_responder_key spec/support/ocsp/$OCSP_ALGORITHM/ocsp-responder.key \
335
- "
336
- else
337
- ocsp_args="$ocsp_args \
338
- --ocsp_responder_cert spec/support/ocsp/$OCSP_ALGORITHM/ca.crt \
339
- --ocsp_responder_key spec/support/ocsp/$OCSP_ALGORITHM/ca.key \
340
- "
341
- fi
342
- if test -n "$OCSP_STATUS"; then
343
- ocsp_args="$ocsp_args --fault $OCSP_STATUS"
344
- fi
345
- fi
346
-
347
- OCSP_ARGS="$ocsp_args"
348
- SERVER_ARGS="$args"
349
- URI_OPTIONS="$uri_options"
350
- }
351
-
352
- launch_ocsp_mock() {
353
- if test -n "$OCSP_ARGS"; then
354
- # Bind to 0.0.0.0 for Docker
355
- python3 spec/support/ocsp/ocsp_mock.py $OCSP_ARGS -b 0.0.0.0 -p 8100 &
356
- OCSP_MOCK_PID=$!
357
- fi
358
- }
359
-
360
- launch_server() {
361
- local dbdir="$1"
362
- python3 -m mtools.mlaunch.mlaunch --dir "$dbdir" --binarypath "$BINDIR" $SERVER_ARGS
363
-
364
- if test "$TOPOLOGY" = sharded-cluster && test $MONGODB_VERSION = 3.6; then
365
- # On 3.6 server the sessions collection is not immediately available,
366
- # so we run the refreshLogicalSessionCacheNow command on the config server
367
- # and again on each mongos in order for the mongoses
368
- # to correctly report logicalSessionTimeoutMinutes.
369
- mongos_regex="\s*mongos\s+([0-9]+)\s+running\s+[0-9]+"
370
- config_server_regex="\s*config\sserver\s+([0-9]+)\s+running\s+[0-9]+"
371
- config_server=""
372
- mongoses=()
373
- if test "$AUTH" = auth
374
- then
375
- base_url="mongodb://bob:pwd123@localhost"
376
- else
377
- base_url="mongodb://localhost"
378
- fi
379
- if test "$SSL" = "ssl"
380
- then
381
- mongo_command="${BINDIR}/mongo --ssl --sslPEMKeyFile $server_cert_path --sslCAFile $server_ca_path"
382
- else
383
- mongo_command="${BINDIR}/mongo"
384
- fi
385
-
386
- while read -r line
387
- do
388
- if [[ $line =~ $config_server_regex ]]
389
- then
390
- port="${BASH_REMATCH[1]}"
391
- config_server="${base_url}:${port}"
392
- fi
393
- if [[ $line =~ $mongos_regex ]]
394
- then
395
- port="${BASH_REMATCH[1]}"
396
- mongoses+=("${base_url}:${port}")
397
- fi
398
- done < <(python2 -m mtools.mlaunch.mlaunch list --dir "$dbdir" --binarypath "$BINDIR")
399
-
400
- if [ -n "$config_server" ]; then
401
- ${mongo_command} "$config_server" --eval 'db.adminCommand("refreshLogicalSessionCacheNow")'
402
- for mongos in ${mongoses[*]}
403
- do
404
- ${mongo_command} "$mongos" --eval 'db.adminCommand("refreshLogicalSessionCacheNow")'
405
- done
406
- fi
407
- fi
408
-
409
- if test "$TOPOLOGY" = load-balanced; then
410
- if test -z "$haproxy_config"; then
411
- echo haproxy_config should have been set 1>&2
412
- exit 3
413
- fi
414
-
415
- haproxy -D -f $haproxy_config -p $mongodb_dir/haproxy.pid
416
- fi
417
- }
@@ -1,146 +0,0 @@
1
- # When changing, also update the hash in share/Dockerfile.
2
- TOOLCHAIN_VERSION=ded7ea845b08cf96f11a747d9540ba3199580dea
3
- JDK_VERSION=jdk17
4
-
5
- set_env_java() {
6
- ls -l /opt || true
7
- ls -l /usr/lib/jvm || true
8
-
9
- # Use toolchain java if it exists
10
- if [ -f /opt/java/$JDK_VERSION/bin/java ]; then
11
- export JAVACMD=/opt/java/$JDK_VERSION/bin/java
12
- else
13
- echo Could not find $JDK_VERSION in /opt/java
14
- fi
15
-
16
- if test -n "$JAVACMD"; then
17
- eval $JAVACMD -version
18
- elif which java 2>/dev/null; then
19
- java -version
20
- else
21
- echo No java runtime found
22
- fi
23
- }
24
-
25
- set_env_python() {
26
- if test "$DOCKER_PRELOAD" != 1; then
27
- if test -n "$DOCKER"; then
28
- # If we are running in Docker and not preloading, we need to fetch the
29
- # Python binary.
30
- curl -fL --retry 3 https://github.com/p-mongodb/deps/raw/main/"$arch"-python37.tar.xz | \
31
- tar xfJ - -C /opt
32
- fi
33
-
34
- if test -d /opt/python/3.7/bin; then
35
- # Most Evergreen configurations.
36
- export PATH=/opt/python/3.7/bin:$PATH
37
- elif test -d /opt/python37/bin; then
38
- # Configurations that use Docker in Evergreen - these don't preload.
39
- export PATH=/opt/python37/bin:$PATH
40
- fi
41
-
42
- python3 -V
43
- fi
44
- }
45
-
46
- set_env_node() {
47
- if test "$DOCKER_PRELOAD" != 1; then
48
- dir=`ls -d /opt/nodejs/node-v12* |head -1`
49
- if test -z "$dir"; then
50
- echo "Node 12 missing" 1>&2
51
- exit 2
52
- fi
53
- export PATH="$dir/bin:$PATH"
54
- elif test -d /opt/node/bin; then
55
- # Node from toolchain in Evergreen
56
- export PATH=/opt/node/bin:$PATH
57
- fi
58
-
59
- node -v
60
- }
61
-
62
- set_env_ruby() {
63
- if test -z "$RVM_RUBY"; then
64
- echo "Empty RVM_RUBY, aborting"
65
- exit 2
66
- fi
67
-
68
- #ls -l /opt
69
-
70
- # Necessary for jruby
71
- set_env_java
72
-
73
- if [ "$RVM_RUBY" == "ruby-head" ]; then
74
- # When we use ruby-head, we do not install the Ruby toolchain.
75
- # But we still need Python 3.6+ to run mlaunch.
76
- # Since the ruby-head tests are run on ubuntu1604, we can use the
77
- # globally installed Python toolchain.
78
- #export PATH=/opt/python/3.7/bin:$PATH
79
-
80
- # 12.04, 14.04 and 16.04 are good
81
- curl --retry 3 -fL http://rubies.travis-ci.org/ubuntu/`lsb_release -rs`/x86_64/ruby-head.tar.bz2 |tar xfj -
82
- # TODO adjust gem path?
83
- export PATH=`pwd`/ruby-head/bin:`pwd`/ruby-head/lib/ruby/gems/2.6.0/bin:$PATH
84
- ruby --version
85
- ruby --version |grep dev
86
- elif test "$SYSTEM_RUBY" = 1; then
87
- # Nothing
88
- :
89
- else
90
- if test "$USE_OPT_TOOLCHAIN" = 1; then
91
- # Nothing, also PATH is already set
92
- :
93
- elif true; then
94
-
95
- # For testing toolchains:
96
- #toolchain_url=https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/`host_distro`/f11598d091441ffc8d746aacfdc6c26741a3e629/mongo_ruby_driver_toolchain_`host_distro |tr - _`_patch_f11598d091441ffc8d746aacfdc6c26741a3e629_5e46f2793e8e866f36eda2c5_20_02_14_19_18_18.tar.gz
97
- toolchain_url=http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/$TOOLCHAIN_VERSION/`host_distro`/$RVM_RUBY.tar.xz
98
- curl --retry 3 -fL $toolchain_url |tar Jxf -
99
- export PATH=`pwd`/rubies/$RVM_RUBY/bin:$PATH
100
- #export PATH=`pwd`/rubies/python/3/bin:$PATH
101
-
102
- # Attempt to get bundler to report all errors - so far unsuccessful
103
- #curl --retry 3 -o bundler-openssl.diff https://github.com/bundler/bundler/compare/v2.0.1...p-mongo:report-errors.diff
104
- #find . -path \*/lib/bundler/fetcher.rb -exec patch {} bundler-openssl.diff \;
105
-
106
- else
107
-
108
- # Normal operation
109
- if ! test -d $HOME/.rubies/$RVM_RUBY/bin; then
110
- echo "Ruby directory does not exist: $HOME/.rubies/$RVM_RUBY/bin" 1>&2
111
- echo "Contents of /opt:" 1>&2
112
- ls -l /opt 1>&2 || true
113
- echo ".rubies symlink:" 1>&2
114
- ls -ld $HOME/.rubies 1>&2 || true
115
- echo "Our rubies:" 1>&2
116
- ls -l $HOME/.rubies 1>&2 || true
117
- exit 2
118
- fi
119
- export PATH=$HOME/.rubies/$RVM_RUBY/bin:$PATH
120
-
121
- fi
122
-
123
- ruby --version
124
-
125
- # Ensure we're using the right ruby
126
- ruby_name=`echo $RVM_RUBY |awk -F- '{print $1}'`
127
- ruby_version=`echo $RVM_RUBY |awk -F- '{print $2}' |cut -c 1-3`
128
-
129
- ruby -v |fgrep $ruby_name
130
- ruby -v |fgrep $ruby_version
131
-
132
- # We shouldn't need to update rubygems, and there is value in
133
- # testing on whatever rubygems came with each supported ruby version
134
- #echo 'updating rubygems'
135
- #gem update --system
136
-
137
- # Only install bundler when not using ruby-head.
138
- # ruby-head comes with bundler and gem complains
139
- # because installing bundler would overwrite the bundler binary.
140
- # We now install bundler in the toolchain, hence nothing needs to be done
141
- # in the tests.
142
- if false && echo "$RVM_RUBY" |grep -q jruby; then
143
- gem install bundler -v '<2'
144
- fi
145
- fi
146
- }
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1 +0,0 @@
1
- R`�#4�ml�k>e�?��/���