mongo 2.20.0 → 2.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -1
- data/Rakefile +59 -23
- data/lib/mongo/address.rb +22 -3
- data/lib/mongo/auth/aws/credentials_retriever.rb +70 -17
- data/lib/mongo/auth/base.rb +1 -1
- data/lib/mongo/bulk_write.rb +35 -2
- data/lib/mongo/client.rb +38 -6
- data/lib/mongo/client_encryption.rb +6 -3
- data/lib/mongo/cluster/reapers/cursor_reaper.rb +6 -1
- data/lib/mongo/cluster/sdam_flow.rb +20 -7
- data/lib/mongo/cluster.rb +14 -4
- data/lib/mongo/collection/helpers.rb +1 -1
- data/lib/mongo/collection/view/aggregation/behavior.rb +131 -0
- data/lib/mongo/collection/view/aggregation.rb +33 -99
- data/lib/mongo/collection/view/builder/aggregation.rb +1 -7
- data/lib/mongo/collection/view/change_stream.rb +80 -27
- data/lib/mongo/collection/view/iterable.rb +76 -60
- data/lib/mongo/collection/view/map_reduce.rb +25 -8
- data/lib/mongo/collection/view/readable.rb +79 -30
- data/lib/mongo/collection/view/writable.rb +109 -48
- data/lib/mongo/collection/view.rb +43 -3
- data/lib/mongo/collection.rb +158 -23
- data/lib/mongo/config.rb +2 -2
- data/lib/mongo/crypt/auto_encrypter.rb +4 -6
- data/lib/mongo/crypt/binding.rb +4 -4
- data/lib/mongo/crypt/context.rb +20 -14
- data/lib/mongo/crypt/encryption_io.rb +56 -26
- data/lib/mongo/crypt/explicit_encrypter.rb +49 -20
- data/lib/mongo/crypt/explicit_encryption_context.rb +17 -11
- data/lib/mongo/crypt/kms/azure/credentials_retriever.rb +22 -6
- data/lib/mongo/crypt/kms/gcp/credentials_retriever.rb +29 -4
- data/lib/mongo/csot_timeout_holder.rb +119 -0
- data/lib/mongo/cursor/kill_spec.rb +5 -2
- data/lib/mongo/cursor/nontailable.rb +27 -0
- data/lib/mongo/cursor.rb +86 -24
- data/lib/mongo/cursor_host.rb +82 -0
- data/lib/mongo/database/view.rb +81 -14
- data/lib/mongo/database.rb +88 -18
- data/lib/mongo/error/operation_failure.rb +209 -204
- data/lib/mongo/error/server_timeout_error.rb +12 -0
- data/lib/mongo/error/socket_timeout_error.rb +3 -1
- data/lib/mongo/error/timeout_error.rb +23 -0
- data/lib/mongo/error.rb +2 -0
- data/lib/mongo/grid/fs_bucket.rb +45 -12
- data/lib/mongo/grid/stream/read.rb +15 -1
- data/lib/mongo/grid/stream/write.rb +21 -4
- data/lib/mongo/index/view.rb +77 -16
- data/lib/mongo/operation/context.rb +40 -2
- data/lib/mongo/operation/create_search_indexes/op_msg.rb +2 -2
- data/lib/mongo/operation/delete/op_msg.rb +2 -1
- data/lib/mongo/operation/drop_search_index/op_msg.rb +2 -2
- data/lib/mongo/operation/find/op_msg.rb +45 -0
- data/lib/mongo/operation/get_more/op_msg.rb +33 -0
- data/lib/mongo/operation/insert/op_msg.rb +3 -2
- data/lib/mongo/operation/insert/result.rb +4 -2
- data/lib/mongo/operation/list_collections/result.rb +1 -1
- data/lib/mongo/operation/map_reduce/result.rb +1 -1
- data/lib/mongo/operation/op_msg_base.rb +3 -1
- data/lib/mongo/operation/result.rb +26 -5
- data/lib/mongo/operation/shared/executable.rb +12 -1
- data/lib/mongo/operation/shared/op_msg_executable.rb +4 -1
- data/lib/mongo/operation/shared/response_handling.rb +3 -3
- data/lib/mongo/operation/shared/sessions_supported.rb +1 -1
- data/lib/mongo/operation/shared/timed.rb +52 -0
- data/lib/mongo/operation/shared/write.rb +4 -1
- data/lib/mongo/operation/update/op_msg.rb +2 -1
- data/lib/mongo/operation/update_search_index/op_msg.rb +2 -2
- data/lib/mongo/operation.rb +1 -0
- data/lib/mongo/protocol/message.rb +1 -4
- data/lib/mongo/protocol/msg.rb +2 -2
- data/lib/mongo/retryable/base_worker.rb +28 -3
- data/lib/mongo/retryable/read_worker.rb +76 -35
- data/lib/mongo/retryable/write_worker.rb +53 -22
- data/lib/mongo/retryable.rb +8 -2
- data/lib/mongo/server/connection.rb +11 -5
- data/lib/mongo/server/connection_base.rb +22 -2
- data/lib/mongo/server/connection_pool.rb +32 -14
- data/lib/mongo/server/description/features.rb +1 -1
- data/lib/mongo/server/description.rb +18 -5
- data/lib/mongo/server/monitor.rb +7 -4
- data/lib/mongo/server/pending_connection.rb +25 -8
- data/lib/mongo/server/{round_trip_time_averager.rb → round_trip_time_calculator.rb} +25 -7
- data/lib/mongo/server.rb +11 -6
- data/lib/mongo/server_selector/base.rb +25 -9
- data/lib/mongo/session.rb +78 -9
- data/lib/mongo/socket/ssl.rb +131 -18
- data/lib/mongo/socket/tcp.rb +40 -6
- data/lib/mongo/socket.rb +154 -25
- data/lib/mongo/uri/options_mapper.rb +1 -0
- data/lib/mongo/version.rb +1 -5
- data/lib/mongo.rb +1 -0
- data/mongo.gemspec +8 -11
- data/spec/atlas/atlas_connectivity_spec.rb +4 -0
- data/spec/atlas/operations_spec.rb +4 -0
- data/spec/integration/client_side_encryption/auto_encryption_mongocryptd_spawn_spec.rb +2 -1
- data/spec/integration/client_side_encryption/auto_encryption_spec.rb +494 -487
- data/spec/integration/client_side_encryption/on_demand_aws_credentials_spec.rb +1 -1
- data/spec/integration/client_side_encryption/range_explicit_encryption_prose_spec.rb +67 -20
- data/spec/integration/client_side_operations_timeout/encryption_prose_spec.rb +131 -0
- data/spec/integration/connection_pool_populator_spec.rb +2 -0
- data/spec/integration/cursor_pinning_spec.rb +15 -60
- data/spec/integration/cursor_reaping_spec.rb +1 -1
- data/spec/integration/docs_examples_spec.rb +1 -1
- data/spec/integration/operation_failure_code_spec.rb +1 -1
- data/spec/integration/operation_failure_message_spec.rb +3 -3
- data/spec/integration/retryable_errors_spec.rb +2 -2
- data/spec/integration/retryable_reads_errors_spec.rb +35 -23
- data/spec/integration/sdam_error_handling_spec.rb +4 -1
- data/spec/integration/search_indexes_prose_spec.rb +4 -0
- data/spec/integration/server_spec.rb +4 -3
- data/spec/integration/transactions_api_examples_spec.rb +2 -0
- data/spec/kerberos/kerberos_spec.rb +4 -0
- data/spec/lite_spec_helper.rb +3 -11
- data/spec/mongo/auth/user/view_spec.rb +1 -1
- data/spec/mongo/caching_cursor_spec.rb +1 -1
- data/spec/mongo/client_encryption_spec.rb +1 -0
- data/spec/mongo/client_spec.rb +158 -4
- data/spec/mongo/collection/view/aggregation_spec.rb +14 -39
- data/spec/mongo/collection/view/change_stream_spec.rb +3 -3
- data/spec/mongo/collection_crud_spec.rb +1 -0
- data/spec/mongo/collection_spec.rb +5 -6
- data/spec/mongo/crypt/auto_encrypter_spec.rb +14 -12
- data/spec/mongo/crypt/data_key_context_spec.rb +3 -1
- data/spec/mongo/crypt/explicit_encryption_context_spec.rb +2 -2
- data/spec/mongo/crypt/handle_spec.rb +1 -1
- data/spec/mongo/cursor_spec.rb +26 -9
- data/spec/mongo/error/operation_failure_heavy_spec.rb +2 -2
- data/spec/mongo/operation/context_spec.rb +79 -0
- data/spec/mongo/operation/create/op_msg_spec.rb +106 -110
- data/spec/mongo/operation/delete/op_msg_spec.rb +6 -5
- data/spec/mongo/operation/find/op_msg_spec.rb +66 -0
- data/spec/mongo/operation/get_more/op_msg_spec.rb +65 -0
- data/spec/mongo/operation/insert/op_msg_spec.rb +128 -131
- data/spec/mongo/operation/shared/csot/examples.rb +113 -0
- data/spec/mongo/query_cache_spec.rb +243 -225
- data/spec/mongo/retryable_spec.rb +1 -0
- data/spec/mongo/server/connection_spec.rb +22 -0
- data/spec/mongo/server/round_trip_time_calculator_spec.rb +120 -0
- data/spec/mongo/socket/ssl_spec.rb +0 -10
- data/spec/runners/change_streams/test.rb +2 -2
- data/spec/runners/crud/operation.rb +1 -1
- data/spec/runners/crud/verifier.rb +3 -1
- data/spec/runners/transactions/operation.rb +4 -6
- data/spec/runners/unified/ambiguous_operations.rb +13 -0
- data/spec/runners/unified/assertions.rb +4 -0
- data/spec/runners/unified/change_stream_operations.rb +14 -24
- data/spec/runners/unified/crud_operations.rb +82 -59
- data/spec/runners/unified/ddl_operations.rb +38 -7
- data/spec/runners/unified/grid_fs_operations.rb +37 -2
- data/spec/runners/unified/support_operations.rb +43 -4
- data/spec/runners/unified/test.rb +22 -10
- data/spec/runners/unified.rb +1 -1
- data/spec/solo/clean_exit_spec.rb +2 -0
- data/spec/spec_tests/client_side_operations_timeout_spec.rb +15 -0
- data/spec/spec_tests/data/change_streams_unified/change-streams-clusterTime.yml +3 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-disambiguatedPaths.yml +3 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-errors.yml +3 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-pre_and_post_images.yml +1 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-allowlist.yml +1 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-resume-errorLabels.yml +1 -1
- data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +1 -1
- data/spec/spec_tests/data/client_side_encryption/badQueries.yml +2 -1
- data/spec/spec_tests/data/client_side_encryption/fle2v2-BypassQueryAnalysis.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Compact.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-CreateCollection.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-DecryptExistingData.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Delete.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFields-vs-jsonSchema.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-EncryptedFieldsMap-defaults.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-FindOneAndUpdate.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-InsertFind-Indexed.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-InsertFind-Unindexed.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-MissingKey.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-NoEncryption.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Update.yml +1 -0
- data/spec/spec_tests/data/client_side_encryption/fle2v2-validatorAndPartialFieldExpression.yml +2 -1
- data/spec/spec_tests/data/client_side_encryption/timeoutMS.yml +67 -0
- data/spec/spec_tests/data/client_side_operations_timeout/bulkWrite.yml +87 -0
- data/spec/spec_tests/data/client_side_operations_timeout/change-streams.yml +358 -0
- data/spec/spec_tests/data/client_side_operations_timeout/close-cursors.yml +129 -0
- data/spec/spec_tests/data/client_side_operations_timeout/command-execution.yml +250 -0
- data/spec/spec_tests/data/client_side_operations_timeout/convenient-transactions.yml +113 -0
- data/spec/spec_tests/data/client_side_operations_timeout/cursors.yml +70 -0
- data/spec/spec_tests/data/client_side_operations_timeout/deprecated-options.yml +3982 -0
- data/spec/spec_tests/data/client_side_operations_timeout/error-transformations.yml +96 -0
- data/spec/spec_tests/data/client_side_operations_timeout/global-timeoutMS.yml +3236 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-advanced.yml +207 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-delete.yml +152 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-download.yml +182 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-find.yml +100 -0
- data/spec/spec_tests/data/client_side_operations_timeout/gridfs-upload.yml +249 -0
- data/spec/spec_tests/data/client_side_operations_timeout/legacy-timeouts.yml +204 -0
- data/spec/spec_tests/data/client_side_operations_timeout/non-tailable-cursors.yml +307 -0
- data/spec/spec_tests/data/client_side_operations_timeout/override-collection-timeoutMS.yml +1877 -0
- data/spec/spec_tests/data/client_side_operations_timeout/override-operation-timeoutMS.yml +1918 -0
- data/spec/spec_tests/data/client_side_operations_timeout/retryability-legacy-timeouts.yml +1676 -0
- data/spec/spec_tests/data/client_side_operations_timeout/retryability-timeoutMS.yml +2824 -0
- data/spec/spec_tests/data/client_side_operations_timeout/sessions-inherit-timeoutMS.yml +168 -0
- data/spec/spec_tests/data/client_side_operations_timeout/sessions-override-operation-timeoutMS.yml +171 -0
- data/spec/spec_tests/data/client_side_operations_timeout/sessions-override-timeoutMS.yml +168 -0
- data/spec/spec_tests/data/client_side_operations_timeout/tailable-awaitData.yml +247 -0
- data/spec/spec_tests/data/client_side_operations_timeout/tailable-non-awaitData.yml +181 -0
- data/spec/spec_tests/data/crud_unified/aggregate-write-readPreference.yml +6 -0
- data/spec/spec_tests/data/crud_unified/db-aggregate-write-readPreference.yml +6 -0
- data/spec/spec_tests/data/crud_unified/find-test-all-options.yml +29 -0
- data/spec/spec_tests/server_selection_rtt_spec.rb +6 -6
- data/spec/spec_tests/transactions_unified_spec.rb +2 -1
- data/spec/support/certificates/atlas-ocsp-ca.crt +89 -79
- data/spec/support/certificates/atlas-ocsp.crt +117 -122
- data/spec/support/certificates/retrieve-atlas-cert +1 -1
- data/spec/support/cluster_tools.rb +3 -3
- data/spec/support/common_shortcuts.rb +2 -2
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-Date.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DecimalNoPrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DecimalPrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DoubleNoPrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-DoublePrecision.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-Int.json +1 -1
- data/spec/support/crypt/encrypted_fields/range-encryptedFields-Long.json +1 -1
- data/spec/support/shared/session.rb +2 -2
- data/spec/support/spec_setup.rb +2 -2
- data/spec/support/utils.rb +3 -1
- metadata +88 -173
- checksums.yaml.gz.sig +0 -0
- data/spec/mongo/server/round_trip_time_averager_spec.rb +0 -48
- data/spec/shared/LICENSE +0 -20
- data/spec/shared/bin/get-mongodb-download-url +0 -17
- data/spec/shared/bin/s3-copy +0 -45
- data/spec/shared/bin/s3-upload +0 -69
- data/spec/shared/lib/mrss/child_process_helper.rb +0 -80
- data/spec/shared/lib/mrss/cluster_config.rb +0 -231
- data/spec/shared/lib/mrss/constraints.rb +0 -378
- data/spec/shared/lib/mrss/docker_runner.rb +0 -298
- data/spec/shared/lib/mrss/eg_config_utils.rb +0 -51
- data/spec/shared/lib/mrss/event_subscriber.rb +0 -210
- data/spec/shared/lib/mrss/lite_constraints.rb +0 -238
- data/spec/shared/lib/mrss/server_version_registry.rb +0 -113
- data/spec/shared/lib/mrss/session_registry.rb +0 -69
- data/spec/shared/lib/mrss/session_registry_legacy.rb +0 -60
- data/spec/shared/lib/mrss/spec_organizer.rb +0 -179
- data/spec/shared/lib/mrss/utils.rb +0 -37
- data/spec/shared/share/Dockerfile.erb +0 -281
- data/spec/shared/share/haproxy-1.conf +0 -16
- data/spec/shared/share/haproxy-2.conf +0 -17
- data/spec/shared/shlib/config.sh +0 -27
- data/spec/shared/shlib/distro.sh +0 -74
- data/spec/shared/shlib/server.sh +0 -417
- data/spec/shared/shlib/set_env.sh +0 -146
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Aggregate.yml +0 -241
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Correctness.yml +0 -422
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Delete.yml +0 -182
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-FindOneAndUpdate.yml +0 -239
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-InsertFind.yml +0 -235
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Date-Update.yml +0 -252
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Aggregate.yml +0 -1687
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Correctness.yml +0 -293
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Delete.yml +0 -905
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-FindOneAndUpdate.yml +0 -1684
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-InsertFind.yml +0 -1680
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Decimal-Update.yml +0 -1697
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Aggregate.yml +0 -329
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Correctness.yml +0 -424
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Delete.yml +0 -226
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-FindOneAndUpdate.yml +0 -327
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-InsertFind.yml +0 -319
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DecimalPrecision-Update.yml +0 -336
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Aggregate.yml +0 -913
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Correctness.yml +0 -292
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Delete.yml +0 -518
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-FindOneAndUpdate.yml +0 -911
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-InsertFind.yml +0 -907
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Double-Update.yml +0 -924
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Aggregate.yml +0 -325
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Correctness.yml +0 -424
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Delete.yml +0 -224
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-FindOneAndUpdate.yml +0 -323
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-InsertFind.yml +0 -319
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-DoublePrecision-Update.yml +0 -338
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Aggregate.yml +0 -241
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Correctness.yml +0 -423
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Delete.yml +0 -182
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-FindOneAndUpdate.yml +0 -239
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-InsertFind.yml +0 -235
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Int-Update.yml +0 -254
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Aggregate.yml +0 -241
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Correctness.yml +0 -422
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Delete.yml +0 -182
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-FindOneAndUpdate.yml +0 -239
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-InsertFind.yml +0 -235
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-Long-Update.yml +0 -254
- data/spec/spec_tests/data/client_side_encryption/fle2v2-Range-WrongType.yml +0 -43
- data/spec/support/faas/app/aws_lambda/mongodb/Gemfile.lock +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -3
data/spec/shared/shlib/server.sh
DELETED
@@ -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
|
-
}
|