mongoid 7.6.0 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -0
- data/README.md +3 -3
- data/Rakefile +21 -85
- data/lib/config/locales/en.yml +46 -30
- data/lib/mongoid/association/accessors.rb +32 -3
- data/lib/mongoid/association/bindable.rb +48 -0
- data/lib/mongoid/association/builders.rb +4 -2
- data/lib/mongoid/association/eager_loadable.rb +29 -7
- data/lib/mongoid/association/embedded/batchable.rb +28 -5
- data/lib/mongoid/association/embedded/embedded_in/binding.rb +24 -2
- data/lib/mongoid/association/embedded/embedded_in.rb +2 -1
- data/lib/mongoid/association/embedded/embeds_many/binding.rb +1 -0
- data/lib/mongoid/association/embedded/embeds_many/buildable.rb +1 -1
- data/lib/mongoid/association/embedded/embeds_many/proxy.rb +40 -18
- data/lib/mongoid/association/embedded/embeds_one/buildable.rb +18 -4
- data/lib/mongoid/association/embedded/embeds_one/proxy.rb +21 -2
- data/lib/mongoid/association/macros.rb +2 -1
- data/lib/mongoid/association/many.rb +5 -0
- data/lib/mongoid/association/nested/many.rb +2 -1
- data/lib/mongoid/association/proxy.rb +12 -0
- data/lib/mongoid/association/referenced/auto_save.rb +3 -2
- data/lib/mongoid/association/referenced/belongs_to/binding.rb +1 -0
- data/lib/mongoid/association/referenced/belongs_to/buildable.rb +1 -1
- data/lib/mongoid/association/referenced/belongs_to.rb +1 -1
- data/lib/mongoid/association/referenced/counter_cache.rb +8 -8
- data/lib/mongoid/association/referenced/has_and_belongs_to_many/proxy.rb +64 -11
- data/lib/mongoid/association/referenced/has_and_belongs_to_many.rb +4 -1
- data/lib/mongoid/association/referenced/has_many/enumerable.rb +10 -18
- data/lib/mongoid/association/referenced/has_many/proxy.rb +12 -9
- data/lib/mongoid/association/referenced/has_one/buildable.rb +1 -1
- data/lib/mongoid/association/referenced/has_one/proxy.rb +8 -11
- data/lib/mongoid/association/referenced/syncable.rb +2 -2
- data/lib/mongoid/association/relatable.rb +38 -4
- data/lib/mongoid/attributes/processing.rb +9 -2
- data/lib/mongoid/attributes.rb +30 -27
- data/lib/mongoid/cacheable.rb +2 -2
- data/lib/mongoid/changeable.rb +37 -2
- data/lib/mongoid/clients/options.rb +4 -0
- data/lib/mongoid/clients/sessions.rb +2 -14
- data/lib/mongoid/config.rb +15 -11
- data/lib/mongoid/contextual/aggregable/memory.rb +23 -15
- data/lib/mongoid/contextual/aggregable/mongo.rb +1 -1
- data/lib/mongoid/contextual/map_reduce.rb +2 -2
- data/lib/mongoid/contextual/memory.rb +55 -28
- data/lib/mongoid/contextual/mongo.rb +173 -287
- data/lib/mongoid/contextual/none.rb +33 -15
- data/lib/mongoid/copyable.rb +32 -8
- data/lib/mongoid/criteria/includable.rb +24 -20
- data/lib/mongoid/criteria/marshalable.rb +10 -2
- data/lib/mongoid/criteria/queryable/extensions/array.rb +2 -15
- data/lib/mongoid/criteria/queryable/extensions/big_decimal.rb +25 -4
- data/lib/mongoid/criteria/queryable/extensions/boolean.rb +1 -1
- data/lib/mongoid/criteria/queryable/extensions/date.rb +6 -1
- data/lib/mongoid/criteria/queryable/extensions/date_time.rb +6 -1
- data/lib/mongoid/criteria/queryable/extensions/hash.rb +0 -16
- data/lib/mongoid/criteria/queryable/extensions/numeric.rb +1 -1
- data/lib/mongoid/criteria/queryable/extensions/object.rb +2 -1
- data/lib/mongoid/criteria/queryable/extensions/range.rb +13 -5
- data/lib/mongoid/criteria/queryable/extensions/regexp.rb +1 -1
- data/lib/mongoid/criteria/queryable/extensions/symbol.rb +3 -1
- data/lib/mongoid/criteria/queryable/extensions/time.rb +6 -1
- data/lib/mongoid/criteria/queryable/extensions/time_with_zone.rb +6 -1
- data/lib/mongoid/criteria/queryable/optional.rb +3 -9
- data/lib/mongoid/criteria/queryable/options.rb +1 -1
- data/lib/mongoid/criteria/queryable/selectable.rb +2 -24
- data/lib/mongoid/criteria/queryable/selector.rb +90 -5
- data/lib/mongoid/criteria/queryable/smash.rb +39 -6
- data/lib/mongoid/criteria/queryable/storable.rb +1 -1
- data/lib/mongoid/criteria/queryable.rb +11 -6
- data/lib/mongoid/criteria.rb +1 -28
- data/lib/mongoid/deprecable.rb +36 -0
- data/lib/mongoid/deprecation.rb +25 -0
- data/lib/mongoid/document.rb +88 -33
- data/lib/mongoid/equality.rb +4 -4
- data/lib/mongoid/errors/document_not_found.rb +6 -2
- data/lib/mongoid/errors/invalid_dot_dollar_assignment.rb +23 -0
- data/lib/mongoid/errors/invalid_field.rb +5 -1
- data/lib/mongoid/errors/invalid_field_type.rb +26 -0
- data/lib/mongoid/errors/too_many_nested_attribute_records.rb +1 -1
- data/lib/mongoid/errors.rb +2 -2
- data/lib/mongoid/extensions/array.rb +8 -6
- data/lib/mongoid/extensions/big_decimal.rb +29 -10
- data/lib/mongoid/extensions/binary.rb +42 -0
- data/lib/mongoid/extensions/boolean.rb +8 -2
- data/lib/mongoid/extensions/date.rb +26 -20
- data/lib/mongoid/extensions/date_time.rb +1 -1
- data/lib/mongoid/extensions/float.rb +4 -5
- data/lib/mongoid/extensions/hash.rb +12 -5
- data/lib/mongoid/extensions/integer.rb +4 -5
- data/lib/mongoid/extensions/object.rb +2 -0
- data/lib/mongoid/extensions/range.rb +41 -10
- data/lib/mongoid/extensions/regexp.rb +11 -4
- data/lib/mongoid/extensions/set.rb +11 -4
- data/lib/mongoid/extensions/string.rb +2 -13
- data/lib/mongoid/extensions/symbol.rb +3 -14
- data/lib/mongoid/extensions/time.rb +27 -16
- data/lib/mongoid/extensions/time_with_zone.rb +1 -2
- data/lib/mongoid/extensions.rb +1 -0
- data/lib/mongoid/factory.rb +42 -7
- data/lib/mongoid/fields/foreign_key.rb +7 -0
- data/lib/mongoid/fields/validators/macro.rb +3 -9
- data/lib/mongoid/fields.rb +49 -7
- data/lib/mongoid/findable.rb +21 -16
- data/lib/mongoid/indexable/specification.rb +1 -1
- data/lib/mongoid/indexable/validators/options.rb +4 -1
- data/lib/mongoid/interceptable.rb +69 -9
- data/lib/mongoid/persistable/creatable.rb +14 -5
- data/lib/mongoid/persistable/updatable.rb +12 -5
- data/lib/mongoid/persistence_context.rb +8 -42
- data/lib/mongoid/query_cache.rb +6 -258
- data/lib/mongoid/railties/controller_runtime.rb +1 -1
- data/lib/mongoid/reloadable.rb +7 -3
- data/lib/mongoid/scopable.rb +9 -11
- data/lib/mongoid/selectable.rb +1 -2
- data/lib/mongoid/shardable.rb +11 -35
- data/lib/mongoid/stateful.rb +27 -1
- data/lib/mongoid/timestamps/created.rb +1 -1
- data/lib/mongoid/timestamps/updated.rb +1 -1
- data/lib/mongoid/touchable.rb +2 -3
- data/lib/mongoid/traversable.rb +1 -0
- data/lib/mongoid/validatable/uniqueness.rb +2 -1
- data/lib/mongoid/version.rb +1 -5
- data/lib/mongoid/warnings.rb +3 -4
- data/lib/mongoid.rb +1 -0
- data/spec/config/mongoid.yml +16 -0
- data/spec/integration/app_spec.rb +8 -12
- data/spec/integration/associations/belongs_to_spec.rb +18 -0
- data/spec/integration/associations/embedded_spec.rb +15 -0
- data/spec/integration/associations/embeds_many_spec.rb +15 -2
- data/spec/integration/associations/embeds_one_spec.rb +18 -0
- data/spec/integration/associations/foreign_key_spec.rb +9 -0
- data/spec/integration/associations/has_and_belongs_to_many_spec.rb +21 -0
- data/spec/integration/associations/has_one_spec.rb +97 -1
- data/spec/integration/associations/scope_option_spec.rb +1 -1
- data/spec/integration/callbacks_models.rb +95 -1
- data/spec/integration/callbacks_spec.rb +226 -4
- data/spec/integration/criteria/range_spec.rb +95 -1
- data/spec/integration/discriminator_key_spec.rb +115 -76
- data/spec/integration/dots_and_dollars_spec.rb +277 -0
- data/spec/integration/i18n_fallbacks_spec.rb +1 -15
- data/spec/integration/matcher_examples_spec.rb +20 -13
- data/spec/integration/matcher_operator_data/type_decimal.yml +3 -2
- data/spec/integration/matcher_operator_spec.rb +3 -5
- data/spec/integration/persistence/range_field_spec.rb +350 -0
- data/spec/mongoid/association/counter_cache_spec.rb +1 -1
- data/spec/mongoid/association/depending_spec.rb +9 -9
- data/spec/mongoid/association/eager_spec.rb +2 -1
- data/spec/mongoid/association/embedded/embedded_in/binding_spec.rb +2 -1
- data/spec/mongoid/association/embedded/embedded_in/buildable_spec.rb +54 -0
- data/spec/mongoid/association/embedded/embedded_in/proxy_spec.rb +69 -9
- data/spec/mongoid/association/embedded/embeds_many/buildable_spec.rb +112 -0
- data/spec/mongoid/association/embedded/embeds_many/proxy_spec.rb +198 -8
- data/spec/mongoid/association/embedded/embeds_many_models.rb +36 -0
- data/spec/mongoid/association/embedded/embeds_many_query_spec.rb +12 -0
- data/spec/mongoid/association/embedded/embeds_many_spec.rb +68 -0
- data/spec/mongoid/association/embedded/embeds_one/buildable_spec.rb +25 -0
- data/spec/mongoid/association/embedded/embeds_one_models.rb +19 -0
- data/spec/mongoid/association/embedded/embeds_one_spec.rb +28 -0
- data/spec/mongoid/association/referenced/belongs_to/binding_spec.rb +2 -1
- data/spec/mongoid/association/referenced/belongs_to/buildable_spec.rb +54 -0
- data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +15 -0
- data/spec/mongoid/association/referenced/belongs_to_models.rb +11 -0
- data/spec/mongoid/association/referenced/belongs_to_spec.rb +2 -2
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb +38 -5
- data/spec/mongoid/association/referenced/has_and_belongs_to_many_models.rb +25 -0
- data/spec/mongoid/association/referenced/has_and_belongs_to_many_spec.rb +35 -2
- data/spec/mongoid/association/referenced/has_many/buildable_spec.rb +109 -0
- data/spec/mongoid/association/referenced/has_many/enumerable_spec.rb +2 -56
- data/spec/mongoid/association/referenced/has_many/proxy_spec.rb +62 -13
- data/spec/mongoid/association/referenced/has_many_models.rb +3 -1
- data/spec/mongoid/association/referenced/has_many_spec.rb +25 -0
- data/spec/mongoid/association/referenced/has_one/buildable_spec.rb +2 -2
- data/spec/mongoid/association/referenced/has_one/proxy_spec.rb +107 -1
- data/spec/mongoid/association/referenced/has_one_models.rb +16 -0
- data/spec/mongoid/association/syncable_spec.rb +14 -0
- data/spec/mongoid/atomic/paths_spec.rb +0 -14
- data/spec/mongoid/attributes/nested_spec.rb +80 -11
- data/spec/mongoid/attributes/nested_spec_models.rb +48 -0
- data/spec/mongoid/attributes/projector_spec.rb +1 -5
- data/spec/mongoid/attributes_spec.rb +480 -27
- data/spec/mongoid/cacheable_spec.rb +3 -3
- data/spec/mongoid/changeable_spec.rb +130 -13
- data/spec/mongoid/clients/factory_spec.rb +23 -30
- data/spec/mongoid/clients/sessions_spec.rb +0 -38
- data/spec/mongoid/clients_spec.rb +2 -2
- data/spec/mongoid/config_spec.rb +52 -15
- data/spec/mongoid/contextual/aggregable/memory_spec.rb +396 -158
- data/spec/mongoid/contextual/aggregable/memory_table.yml +88 -0
- data/spec/mongoid/contextual/aggregable/memory_table_spec.rb +62 -0
- data/spec/mongoid/contextual/map_reduce_spec.rb +2 -16
- data/spec/mongoid/contextual/memory_spec.rb +521 -14
- data/spec/mongoid/contextual/mongo_spec.rb +566 -426
- data/spec/mongoid/contextual/none_spec.rb +11 -19
- data/spec/mongoid/copyable_spec.rb +451 -2
- data/spec/mongoid/criteria/findable_spec.rb +86 -210
- data/spec/mongoid/criteria/includable_spec.rb +1492 -0
- data/spec/mongoid/criteria/includable_spec_models.rb +54 -0
- data/spec/mongoid/criteria/marshalable_spec.rb +18 -1
- data/spec/mongoid/criteria/queryable/extensions/array_spec.rb +7 -19
- data/spec/mongoid/criteria/queryable/extensions/big_decimal_spec.rb +134 -26
- data/spec/mongoid/criteria/queryable/extensions/bignum_spec.rb +1 -2
- data/spec/mongoid/criteria/queryable/extensions/date_spec.rb +11 -0
- data/spec/mongoid/criteria/queryable/extensions/date_time_spec.rb +11 -0
- data/spec/mongoid/criteria/queryable/extensions/fixnum_spec.rb +1 -2
- data/spec/mongoid/criteria/queryable/extensions/hash_spec.rb +0 -15
- data/spec/mongoid/criteria/queryable/extensions/numeric_spec.rb +73 -7
- data/spec/mongoid/criteria/queryable/extensions/time_spec.rb +11 -0
- data/spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb +11 -0
- data/spec/mongoid/criteria/queryable/optional_spec.rb +0 -484
- data/spec/mongoid/criteria/queryable/selectable_logical_spec.rb +50 -0
- data/spec/mongoid/criteria/queryable/selectable_spec.rb +77 -85
- data/spec/mongoid/criteria/queryable/selector_spec.rb +16 -77
- data/spec/mongoid/criteria/queryable/storable_spec.rb +0 -72
- data/spec/mongoid/criteria_spec.rb +469 -1201
- data/spec/mongoid/document_fields_spec.rb +173 -24
- data/spec/mongoid/document_spec.rb +32 -41
- data/spec/mongoid/equality_spec.rb +12 -12
- data/spec/mongoid/errors/document_not_found_spec.rb +29 -2
- data/spec/mongoid/errors/invalid_field_spec.rb +1 -1
- data/spec/mongoid/errors/invalid_field_type_spec.rb +55 -0
- data/spec/mongoid/errors/mongoid_error_spec.rb +3 -1
- data/spec/mongoid/errors/no_environment_spec.rb +3 -3
- data/spec/mongoid/errors/too_many_nested_attribute_records_spec.rb +1 -1
- data/spec/mongoid/extensions/array_spec.rb +16 -2
- data/spec/mongoid/extensions/big_decimal_spec.rb +697 -212
- data/spec/mongoid/extensions/binary_spec.rb +44 -9
- data/spec/mongoid/extensions/boolean_spec.rb +68 -82
- data/spec/mongoid/extensions/date_class_mongoize_spec.rb +7 -3
- data/spec/mongoid/extensions/date_spec.rb +71 -1
- data/spec/mongoid/extensions/date_time_spec.rb +15 -9
- data/spec/mongoid/extensions/float_spec.rb +48 -76
- data/spec/mongoid/extensions/hash_spec.rb +30 -0
- data/spec/mongoid/extensions/integer_spec.rb +45 -66
- data/spec/mongoid/extensions/range_spec.rb +255 -54
- data/spec/mongoid/extensions/regexp_spec.rb +58 -33
- data/spec/mongoid/extensions/set_spec.rb +106 -0
- data/spec/mongoid/extensions/string_spec.rb +53 -25
- data/spec/mongoid/extensions/symbol_spec.rb +18 -25
- data/spec/mongoid/extensions/time_spec.rb +634 -66
- data/spec/mongoid/extensions/time_with_zone_spec.rb +17 -31
- data/spec/mongoid/factory_spec.rb +61 -1
- data/spec/mongoid/fields_spec.rb +321 -50
- data/spec/mongoid/findable_spec.rb +64 -29
- data/spec/mongoid/indexable/specification_spec.rb +2 -2
- data/spec/mongoid/indexable_spec.rb +16 -19
- data/spec/mongoid/interceptable_spec.rb +584 -5
- data/spec/mongoid/interceptable_spec_models.rb +235 -4
- data/spec/mongoid/matcher/extract_attribute_spec.rb +1 -5
- data/spec/mongoid/mongoizable_spec.rb +285 -0
- data/spec/mongoid/persistable/creatable_spec.rb +2 -2
- data/spec/mongoid/persistable/deletable_spec.rb +2 -2
- data/spec/mongoid/persistable/destroyable_spec.rb +2 -2
- data/spec/mongoid/persistable/upsertable_spec.rb +14 -0
- data/spec/mongoid/persistence_context_spec.rb +24 -0
- data/spec/mongoid/query_cache_middleware_spec.rb +0 -18
- data/spec/mongoid/query_cache_spec.rb +1 -156
- data/spec/mongoid/reloadable_spec.rb +35 -2
- data/spec/mongoid/scopable_spec.rb +36 -34
- data/spec/mongoid/serializable_spec.rb +14 -7
- data/spec/mongoid/shardable_models.rb +0 -14
- data/spec/mongoid/shardable_spec.rb +61 -153
- data/spec/mongoid/stateful_spec.rb +28 -0
- data/spec/mongoid/timestamps_spec.rb +390 -0
- data/spec/mongoid/timestamps_spec_models.rb +67 -0
- data/spec/mongoid/touchable_spec.rb +116 -0
- data/spec/mongoid/touchable_spec_models.rb +12 -8
- data/spec/mongoid/traversable_spec.rb +4 -11
- data/spec/mongoid/validatable/presence_spec.rb +1 -1
- data/spec/mongoid/validatable/uniqueness_spec.rb +60 -31
- data/spec/mongoid/warnings_spec.rb +35 -0
- data/spec/mongoid_spec.rb +1 -7
- data/spec/rails/controller_extension/controller_runtime_spec.rb +2 -2
- data/spec/rails/mongoid_spec.rb +4 -16
- data/spec/shared/lib/mrss/docker_runner.rb +1 -8
- data/spec/shared/lib/mrss/event_subscriber.rb +5 -15
- data/spec/shared/lib/mrss/lite_constraints.rb +2 -10
- data/spec/shared/lib/mrss/server_version_registry.rb +24 -17
- data/spec/shared/lib/mrss/spec_organizer.rb +3 -32
- data/spec/shared/lib/mrss/utils.rb +6 -28
- data/spec/shared/share/Dockerfile.erb +107 -33
- data/spec/shared/shlib/distro.sh +0 -10
- data/spec/shared/shlib/server.sh +33 -64
- data/spec/shared/shlib/set_env.sh +71 -12
- data/spec/support/constraints.rb +24 -0
- data/spec/support/expectations.rb +17 -20
- data/spec/support/macros.rb +30 -0
- data/spec/support/models/augmentation.rb +12 -0
- data/spec/support/models/band.rb +3 -0
- data/spec/support/models/catalog.rb +24 -0
- data/spec/support/models/circus.rb +3 -0
- data/spec/support/models/fanatic.rb +8 -0
- data/spec/support/models/implant.rb +9 -0
- data/spec/support/models/label.rb +2 -0
- data/spec/support/models/passport.rb +9 -0
- data/spec/support/models/person.rb +1 -0
- data/spec/support/models/player.rb +2 -0
- data/spec/support/models/powerup.rb +12 -0
- data/spec/support/models/registry.rb +1 -0
- data/spec/support/models/school.rb +14 -0
- data/spec/support/models/shield.rb +18 -0
- data/spec/support/models/student.rb +14 -0
- data/spec/support/models/weapon.rb +12 -0
- data.tar.gz.sig +0 -0
- metadata +695 -641
- metadata.gz.sig +0 -0
- data/lib/mongoid/errors/eager_load.rb +0 -23
- data/lib/mongoid/errors/invalid_value.rb +0 -17
- data/spec/mongoid/errors/eager_load_spec.rb +0 -31
- data/spec/shared/CANDIDATE.md +0 -28
- data/spec/shared/lib/mrss/release/candidate.rb +0 -281
- data/spec/shared/lib/mrss/release/product_data.rb +0 -144
- data/spec/shared/lib/tasks/candidate.rake +0 -64
|
@@ -3,35 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
module Mrss
|
|
5
5
|
module Utils
|
|
6
|
-
extend self
|
|
7
6
|
|
|
8
|
-
def print_backtrace(dest=STDERR)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# Parses the given version string, accounting for suffix information that
|
|
15
|
-
# Gem::Version cannot successfully parse.
|
|
16
|
-
#
|
|
17
|
-
# @param [ String ] version the version to parse
|
|
18
|
-
#
|
|
19
|
-
# @return [ Gem::Version ] the parsed version
|
|
20
|
-
#
|
|
21
|
-
# @raise [ ArgumentError ] if the string cannot be parsed.
|
|
22
|
-
def parse_version(version)
|
|
23
|
-
Gem::Version.new(version)
|
|
24
|
-
rescue ArgumentError
|
|
25
|
-
match = version.match(/\A(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)?(-[A-Za-z\+\d]+)?\z/)
|
|
26
|
-
raise ArgumentError.new("Malformed version number string #{version}") if match.nil?
|
|
27
|
-
|
|
28
|
-
Gem::Version.new(
|
|
29
|
-
[
|
|
30
|
-
match[:major],
|
|
31
|
-
match[:minor],
|
|
32
|
-
match[:patch]
|
|
33
|
-
].join('.')
|
|
34
|
-
)
|
|
7
|
+
module_function def print_backtrace(dest=STDERR)
|
|
8
|
+
begin
|
|
9
|
+
hello world
|
|
10
|
+
rescue => e
|
|
11
|
+
dest.puts e.backtrace.join("\n")
|
|
12
|
+
end
|
|
35
13
|
end
|
|
36
14
|
end
|
|
37
15
|
end
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
+
# Python toolchain as of this writing is available on rhel62, debian92 and
|
|
2
|
+
# ubuntu1604.
|
|
3
|
+
#
|
|
4
|
+
# To run rhel62 in docker, host system must be configured to emulate syscalls:
|
|
5
|
+
# https://github.com/CentOS/sig-cloud-instance-images/issues/103
|
|
6
|
+
|
|
1
7
|
<%
|
|
2
8
|
|
|
9
|
+
python_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-python-driver-toolchain/#{distro}/ba92de2700c04ee2d4f82c3ffdfc33105140cb04/mongo_python_driver_toolchain_#{distro.gsub('-', '_')}_ba92de2700c04ee2d4f82c3ffdfc33105140cb04_19_11_14_15_33_33.tar.gz"
|
|
10
|
+
server_version = '4.3.3'
|
|
11
|
+
server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
|
|
12
|
+
server_archive_basename = File.basename(server_url)
|
|
13
|
+
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
|
|
14
|
+
|
|
15
|
+
# When changing, also update the hash in shlib/set_env.sh.
|
|
16
|
+
TOOLCHAIN_VERSION='219833abad4d9d3bf43c0fef101a8ca082ac4ae9'
|
|
17
|
+
|
|
3
18
|
def ruby_toolchain_url(ruby)
|
|
4
|
-
"http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-
|
|
19
|
+
"http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/#{TOOLCHAIN_VERSION}/#{distro}/#{ruby}.tar.xz"
|
|
5
20
|
end
|
|
6
21
|
|
|
22
|
+
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{TOOLCHAIN_VERSION}/mongo_ruby_driver_toolchain_#{distro.gsub('-', '_')}_patch_#{TOOLCHAIN_VERSION}_#{toolchain_lower}.tar.gz"
|
|
23
|
+
|
|
7
24
|
%>
|
|
8
25
|
|
|
9
26
|
FROM <%= base_image %>
|
|
@@ -20,6 +37,18 @@ ENV DOCKER=1
|
|
|
20
37
|
|
|
21
38
|
<% end %>
|
|
22
39
|
|
|
40
|
+
<% if ruby_head? %>
|
|
41
|
+
|
|
42
|
+
# To use current versions of mlaunch, Python 3.7+ is required.
|
|
43
|
+
# Many distros ship with older Pythons, therefore we need to install
|
|
44
|
+
# a newer Python from somewhere. This section installs the Python
|
|
45
|
+
# toolchain which comes with recent Pythons.
|
|
46
|
+
|
|
47
|
+
#RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
|
|
48
|
+
#RUN tar -xC /opt -zf python-toolchain.tar.gz
|
|
49
|
+
|
|
50
|
+
<% end %>
|
|
51
|
+
|
|
23
52
|
<% if debian? %>
|
|
24
53
|
|
|
25
54
|
# zsh is not required for any scripts but it is a better interactive shell
|
|
@@ -27,7 +56,7 @@ ENV DOCKER=1
|
|
|
27
56
|
# Ruby runtime dependencies: libyaml-0-2
|
|
28
57
|
# Compiling ruby libraries: gcc make
|
|
29
58
|
# Compiling python packages: python3-dev
|
|
30
|
-
# JRuby: openjdk-
|
|
59
|
+
# JRuby: openjdk-8-jdk-headless
|
|
31
60
|
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
|
32
61
|
# Determining OS we are running on: lsb-release
|
|
33
62
|
# Load balancer testing: haproxy
|
|
@@ -48,45 +77,75 @@ ENV DOCKER=1
|
|
|
48
77
|
# therefore install python-pip in all configurations here.
|
|
49
78
|
|
|
50
79
|
<% packages = %w(
|
|
51
|
-
procps lsb-release bzip2 curl
|
|
52
|
-
git make gcc
|
|
80
|
+
procps lsb-release bzip2 curl zsh
|
|
81
|
+
git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
|
|
53
82
|
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
|
54
|
-
haproxy
|
|
55
|
-
|
|
56
|
-
|
|
83
|
+
haproxy
|
|
84
|
+
python3-pip
|
|
85
|
+
tzdata shared-mime-info
|
|
57
86
|
) %>
|
|
58
87
|
|
|
59
88
|
<% if distro =~ /ubuntu2004/ %>
|
|
60
89
|
<% packages << 'libsnmp35' %>
|
|
61
|
-
<% elsif distro =~ /ubuntu2204|debian11/ %>
|
|
62
|
-
<% packages << 'libsnmp40' %>
|
|
63
90
|
<% else %>
|
|
64
91
|
<% packages << 'libsnmp30' %>
|
|
65
92
|
<% end %>
|
|
66
93
|
|
|
67
|
-
<% if distro !~ /ubuntu2004
|
|
94
|
+
<% if distro !~ /ubuntu2004/ %>
|
|
68
95
|
<% packages << 'python-pip' %>
|
|
69
96
|
<% end %>
|
|
70
97
|
|
|
71
|
-
<% if distro =~ /
|
|
72
|
-
<% packages << '
|
|
98
|
+
<% if distro =~ /debian10/ %>
|
|
99
|
+
<% packages << 'openjdk-11-jdk-headless' %>
|
|
100
|
+
<% elsif distro =~ /ubuntu1404/ %>
|
|
101
|
+
# Ubuntu 14.04 only has openjdk 7, this is too old to be useful
|
|
102
|
+
<% else %>
|
|
103
|
+
<% packages << 'openjdk-8-jdk-headless' %>
|
|
73
104
|
<% end %>
|
|
74
105
|
|
|
75
|
-
|
|
76
|
-
|
|
106
|
+
# ubuntu1404, ubuntu1604: libcurl3
|
|
107
|
+
# ubuntu1804, ubuntu2004, debian10: libcurl4
|
|
108
|
+
<% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
|
|
109
|
+
<% packages << 'libcurl4' %>
|
|
110
|
+
<% else %>
|
|
111
|
+
<% packages << 'libcurl3' %>
|
|
77
112
|
<% end %>
|
|
78
113
|
|
|
79
|
-
|
|
114
|
+
<% if distro =~ /ubuntu1804|ubuntu2004/ %>
|
|
115
|
+
<% packages << 'nodejs' %>
|
|
116
|
+
<% end %>
|
|
80
117
|
|
|
81
|
-
<% if
|
|
82
|
-
|
|
83
|
-
RUN echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null
|
|
118
|
+
<% if distro =~ /ubuntu2004/ %>
|
|
119
|
+
<% packages += %w(ruby ruby2.7 bundler) %>
|
|
84
120
|
<% end %>
|
|
85
|
-
|
|
86
|
-
RUN apt-get update && apt-get install -y
|
|
87
|
-
|
|
121
|
+
|
|
122
|
+
RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
|
|
123
|
+
|
|
88
124
|
<% else %>
|
|
89
125
|
|
|
126
|
+
<% if distro =~ /rhel6/ %>
|
|
127
|
+
|
|
128
|
+
# CentOS 6 is dead - to use it retrieve the packages from vault:
|
|
129
|
+
# https://stackoverflow.com/questions/53562691/error-cannot-retrieve-repository-metadata-repomd-xml-for-repository-base-pl
|
|
130
|
+
|
|
131
|
+
<%
|
|
132
|
+
|
|
133
|
+
cfg = <<-CFG
|
|
134
|
+
[base]
|
|
135
|
+
name=CentOS-$releasever - Base
|
|
136
|
+
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
|
|
137
|
+
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
|
|
138
|
+
baseurl=http://vault.centos.org/6.10/os/x86_64/
|
|
139
|
+
gpgcheck=1
|
|
140
|
+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
|
141
|
+
CFG
|
|
142
|
+
|
|
143
|
+
%>
|
|
144
|
+
|
|
145
|
+
RUN printf "<%= cfg.gsub("\n", "\\n") %>" >/etc/yum.repos.d/CentOS-Base.repo
|
|
146
|
+
|
|
147
|
+
<% end %>
|
|
148
|
+
|
|
90
149
|
# Enterprise server: net-snmp
|
|
91
150
|
# lsb_release: redhat-lsb-core
|
|
92
151
|
# our runner scripts: which
|
|
@@ -95,16 +154,31 @@ ENV DOCKER=1
|
|
|
95
154
|
# Kerberos tests: krb5-workstation + cyrus-sasl-devel to build the
|
|
96
155
|
# mongo_kerberos gem + cyrus-sasl-gssapi for authentication to work
|
|
97
156
|
# Local Kerberos server: krb5-server
|
|
98
|
-
# JRuby: java-
|
|
157
|
+
# JRuby: java-1.8.0-openjdk
|
|
99
158
|
#
|
|
100
159
|
# Note: lacking cyrus-sasl-gssapi produces a cryptic message
|
|
101
160
|
# "SASL(-4): no mechanism available: No worthy mechs found"
|
|
102
161
|
# https://github.com/farorm/python-ad/issues/10
|
|
103
162
|
|
|
104
|
-
RUN yum
|
|
105
|
-
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-
|
|
106
|
-
net-snmp
|
|
163
|
+
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
|
|
164
|
+
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
|
|
165
|
+
net-snmp python3
|
|
166
|
+
|
|
167
|
+
<% if distro =~ /rhel6/ %>
|
|
168
|
+
|
|
169
|
+
# RHEL 6 ships with Python 2.6.
|
|
170
|
+
|
|
171
|
+
RUN yum install -y centos-release-scl && \
|
|
172
|
+
yum install -y python27-python python27-python-devel
|
|
173
|
+
ENV PATH=/opt/rh/python27/root/usr/bin:$PATH \
|
|
174
|
+
LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64
|
|
175
|
+
|
|
176
|
+
<% else %>
|
|
177
|
+
|
|
178
|
+
RUN yum install -y python-devel
|
|
107
179
|
|
|
180
|
+
<% end %>
|
|
181
|
+
|
|
108
182
|
<% end %>
|
|
109
183
|
|
|
110
184
|
<% if preload? %>
|
|
@@ -146,7 +220,7 @@ ENV DOCKER=1
|
|
|
146
220
|
<% when 'git' %>
|
|
147
221
|
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
|
148
222
|
RUN python3 -m pip install virtualenv 'pymongo>=4' python-dateutil psutil
|
|
149
|
-
|
|
223
|
+
|
|
150
224
|
# Install mtools from git because released versions do not work with pymongo 4.0
|
|
151
225
|
RUN git clone https://github.com/p-mongodb/mtools && \
|
|
152
226
|
cd mtools && \
|
|
@@ -160,7 +234,7 @@ ENV DOCKER=1
|
|
|
160
234
|
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
|
161
235
|
# ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
|
|
162
236
|
# as specified by dependencies, causing OCSP mock to not work.
|
|
163
|
-
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
|
|
237
|
+
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
|
|
164
238
|
<% end %>
|
|
165
239
|
|
|
166
240
|
# FLE is tested against 4.0+ servers.
|
|
@@ -169,7 +243,7 @@ ENV DOCKER=1
|
|
|
169
243
|
# boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
|
|
170
244
|
# cryptography does not install due to lacking setuptools_rust
|
|
171
245
|
# (either that version or anything that isn't part of system packages)
|
|
172
|
-
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0
|
|
246
|
+
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0
|
|
173
247
|
<% end %>
|
|
174
248
|
|
|
175
249
|
<% unless ruby_head? || system_ruby? %>
|
|
@@ -177,9 +251,14 @@ ENV DOCKER=1
|
|
|
177
251
|
RUN curl --retry 3 -fL <%= ruby_toolchain_url(ruby) %> |tar -xC /opt -Jf -
|
|
178
252
|
ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
|
|
179
253
|
USE_OPT_TOOLCHAIN=1
|
|
254
|
+
#ENV PATH=/opt/rubies/python/3/bin:$PATH
|
|
180
255
|
|
|
181
256
|
<% end %>
|
|
182
257
|
|
|
258
|
+
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
|
|
259
|
+
mv mongo*/ /opt/mongodb
|
|
260
|
+
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
|
261
|
+
|
|
183
262
|
<% end %>
|
|
184
263
|
|
|
185
264
|
<% if distro =~ /debian|ubuntu/ %>
|
|
@@ -219,8 +298,6 @@ WORKDIR /app
|
|
|
219
298
|
ENV DOCKER_PRELOAD=1
|
|
220
299
|
<% end %>
|
|
221
300
|
|
|
222
|
-
RUN npm install --global yarn
|
|
223
|
-
|
|
224
301
|
ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
|
|
225
302
|
PROJECT_DIRECTORY=/app \
|
|
226
303
|
<%= @env.map { |k, v| %Q`#{k}="#{v.gsub('$', "\\$").gsub('"', "\\\"")}"` }.join(" \\\n ") %>
|
|
@@ -231,9 +308,6 @@ ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
|
|
|
231
308
|
|
|
232
309
|
COPY . .
|
|
233
310
|
|
|
234
|
-
RUN bash -c '. .evergreen/download-mongodb.sh && get_distro && get_mongodb_download_url_for "$DISTRO" "<%= server_version %>" && curl --retry 3 -fL $MONGODB_DOWNLOAD_URL |tar xzf - && mv mongo*/ /opt/mongodb'
|
|
235
|
-
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
|
236
|
-
|
|
237
311
|
<% if expose? %>
|
|
238
312
|
|
|
239
313
|
<% ports = [] %>
|
data/spec/shared/shlib/distro.sh
CHANGED
|
@@ -64,16 +64,6 @@ _detect_distro() {
|
|
|
64
64
|
release=`echo $release |sed -e s/7/70/ -e s/6/62/ -e s/8/80/`
|
|
65
65
|
distro=rhel$release
|
|
66
66
|
fi
|
|
67
|
-
elif test -f /etc/os-release; then
|
|
68
|
-
name=`grep -o '^NAME=.*' /etc/os-release | awk -F '"' '{ print $2 }'`
|
|
69
|
-
version=`grep -o '^VERSION=.*' /etc/os-release | awk -F '"' '{ print $2 }'`
|
|
70
|
-
if test "$name" = "Amazon Linux"; then
|
|
71
|
-
distro=amazon$version
|
|
72
|
-
else
|
|
73
|
-
cat /etc/os-release
|
|
74
|
-
echo 'Unknown distro' 1>&2
|
|
75
|
-
exit 1
|
|
76
|
-
fi
|
|
77
67
|
else
|
|
78
68
|
lsb_release -a
|
|
79
69
|
echo 'Unknown distro' 1>&2
|
data/spec/shared/shlib/server.sh
CHANGED
|
@@ -35,50 +35,48 @@ add_uri_option() {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
prepare_server() {
|
|
38
|
+
arch=$1
|
|
39
|
+
|
|
38
40
|
if test -n "$USE_OPT_MONGODB"; then
|
|
39
41
|
export BINDIR=/opt/mongodb/bin
|
|
40
42
|
export PATH=$BINDIR:$PATH
|
|
41
43
|
return
|
|
42
44
|
fi
|
|
43
45
|
|
|
44
|
-
|
|
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
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
48
60
|
|
|
49
|
-
get_mongodb_download_url_for "$arch" "$MONGODB_VERSION"
|
|
50
|
-
prepare_server_from_url "$MONGODB_DOWNLOAD_URL" "$MONGOSH_DOWNLOAD_URL"
|
|
51
61
|
}
|
|
52
62
|
|
|
53
63
|
prepare_server_from_url() {
|
|
54
|
-
|
|
55
|
-
mongosh_url=$2
|
|
64
|
+
url=$1
|
|
56
65
|
|
|
57
|
-
dirname=`basename $
|
|
66
|
+
dirname=`basename $url |sed -e s/.tgz//`
|
|
58
67
|
mongodb_dir="$MONGO_ORCHESTRATION_HOME"/mdb/"$dirname"
|
|
59
68
|
mkdir -p "$mongodb_dir"
|
|
60
|
-
curl --retry 3 $
|
|
61
|
-
|
|
62
|
-
if test -n "$mongosh_url"; then
|
|
63
|
-
curl --retry 3 $mongosh_url | tar xz -C "$mongodb_dir" --strip-components 1 -f -
|
|
64
|
-
fi
|
|
65
|
-
|
|
69
|
+
curl --retry 3 $url | tar xz -C "$mongodb_dir" --strip-components 1 -f -
|
|
66
70
|
BINDIR="$mongodb_dir"/bin
|
|
67
71
|
export PATH="$BINDIR":$PATH
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
install_mlaunch_virtualenv() {
|
|
71
75
|
python3 -V || true
|
|
72
|
-
if ! python3 -m
|
|
76
|
+
if ! python3 -m virtualenv -h >/dev/null; then
|
|
73
77
|
# Current virtualenv fails with
|
|
74
78
|
# https://github.com/pypa/virtualenv/issues/1630
|
|
75
|
-
python3 -m pip install
|
|
76
|
-
fi
|
|
77
|
-
if ! python3 -m ensurepip -h > /dev/null; then
|
|
78
|
-
# Debian11/Ubuntu2204 have venv installed, but it is nonfunctional unless
|
|
79
|
-
# the python3-venv package is also installed (it lacks the ensurepip
|
|
80
|
-
# module).
|
|
81
|
-
sudo apt-get update && sudo apt-get install --yes python3-venv
|
|
79
|
+
python3 -m pip install 'virtualenv<20' --user
|
|
82
80
|
fi
|
|
83
81
|
if test "$USE_SYSTEM_PYTHON_PACKAGES" = 1 &&
|
|
84
82
|
python3 -m pip list |grep mtools
|
|
@@ -86,21 +84,15 @@ install_mlaunch_venv() {
|
|
|
86
84
|
# Use the existing mtools-legacy
|
|
87
85
|
:
|
|
88
86
|
else
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
venvpath="$MONGO_ORCHESTRATION_HOME"/venv
|
|
93
|
-
python3 -m venv $venvpath
|
|
94
|
-
. $venvpath/bin/activate
|
|
95
|
-
fi
|
|
96
|
-
|
|
87
|
+
venvpath="$MONGO_ORCHESTRATION_HOME"/venv
|
|
88
|
+
python3 -m virtualenv -p python3 $venvpath
|
|
89
|
+
. $venvpath/bin/activate
|
|
97
90
|
# [mlaunch] does not work:
|
|
98
91
|
# https://github.com/rueckstiess/mtools/issues/856
|
|
99
92
|
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
|
100
93
|
#pip install 'mtools==1.7' 'pymongo==4.1' python-dateutil psutil
|
|
101
|
-
|
|
94
|
+
|
|
102
95
|
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
|
103
|
-
pip install --upgrade setuptools
|
|
104
96
|
pip install 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
|
|
105
97
|
fi
|
|
106
98
|
}
|
|
@@ -166,32 +158,6 @@ install_mlaunch_git() {
|
|
|
166
158
|
fi
|
|
167
159
|
}
|
|
168
160
|
|
|
169
|
-
install_haproxy() {
|
|
170
|
-
if ! command -v haproxy &> /dev/null; then
|
|
171
|
-
if ! command -v apt-get &> /dev/null; then
|
|
172
|
-
# no apt-get; assume RHEL
|
|
173
|
-
sudo yum -y install haproxy
|
|
174
|
-
else
|
|
175
|
-
sudo apt-get update && sudo apt-get install --yes haproxy
|
|
176
|
-
fi
|
|
177
|
-
else
|
|
178
|
-
echo 'haproxy is present'
|
|
179
|
-
fi
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
install_cmake() {
|
|
183
|
-
if ! command -v cmake &> /dev/null; then
|
|
184
|
-
if ! command -v apt-get &> /dev/null; then
|
|
185
|
-
# no apt-get; assume RHEL
|
|
186
|
-
sudo yum -y install cmake libarchive
|
|
187
|
-
else
|
|
188
|
-
sudo apt-get update && sudo apt-get install --yes cmake
|
|
189
|
-
fi
|
|
190
|
-
else
|
|
191
|
-
echo 'cmake is present'
|
|
192
|
-
fi
|
|
193
|
-
}
|
|
194
|
-
|
|
195
161
|
# This function sets followong global variables:
|
|
196
162
|
# server_cert_path
|
|
197
163
|
# server_ca_path
|
|
@@ -207,7 +173,7 @@ calculate_server_args() {
|
|
|
207
173
|
fi
|
|
208
174
|
|
|
209
175
|
if test $mongo_version = latest; then
|
|
210
|
-
mongo_version=
|
|
176
|
+
mongo_version=60
|
|
211
177
|
fi
|
|
212
178
|
|
|
213
179
|
local args="--setParameter enableTestCommands=1"
|
|
@@ -218,14 +184,17 @@ calculate_server_args() {
|
|
|
218
184
|
args="$args --setParameter acceptAPIVersion2=1"
|
|
219
185
|
fi
|
|
220
186
|
|
|
221
|
-
|
|
222
|
-
|
|
187
|
+
# diagnosticDataCollectionEnabled is a mongod-only parameter on server 3.2,
|
|
188
|
+
# and mlaunch does not support specifying mongod-only parameters:
|
|
189
|
+
# https://github.com/rueckstiess/mtools/issues/696
|
|
190
|
+
# Pass it to 3.4 and newer servers where it is accepted by all daemons.
|
|
191
|
+
if test $mongo_version -ge 34; then
|
|
192
|
+
args="$args --setParameter diagnosticDataCollectionEnabled=false"
|
|
193
|
+
fi
|
|
223
194
|
local uri_options=
|
|
224
195
|
if test "$TOPOLOGY" = replica-set; then
|
|
225
196
|
args="$args --replicaset --name test-rs --nodes 2 --arbiter"
|
|
226
197
|
export HAVE_ARBITER=1
|
|
227
|
-
elif test "$TOPOLOGY" = replica-set-single-node; then
|
|
228
|
-
args="$args --replicaset --name test-rs --nodes 1"
|
|
229
198
|
elif test "$TOPOLOGY" = sharded-cluster; then
|
|
230
199
|
args="$args --replicaset --nodes 2 --sharded 1 --name test-rs"
|
|
231
200
|
if test -z "$SINGLE_MONGOS"; then
|
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
# When changing, also update the hash in share/Dockerfile.
|
|
2
|
-
|
|
2
|
+
TOOLCHAIN_VERSION=219833abad4d9d3bf43c0fef101a8ca082ac4ae9
|
|
3
3
|
|
|
4
4
|
set_env_java() {
|
|
5
5
|
ls -l /opt || true
|
|
6
6
|
ls -l /usr/lib/jvm || true
|
|
7
7
|
|
|
8
8
|
# Use toolchain java if it exists
|
|
9
|
-
if [ -f /opt/java
|
|
10
|
-
export JAVACMD=/opt/java
|
|
9
|
+
if [ -f /opt/java/jdk8/bin/java ]; then
|
|
10
|
+
export JAVACMD=/opt/java/jdk8/bin/java
|
|
11
|
+
#export PATH=$PATH:/opt/java/jdk8/bin
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
# ppc64le has it in a different place
|
|
15
|
+
if test -z "$JAVACMD" && [ -f /usr/lib/jvm/java-1.8.0/bin/java ]; then
|
|
16
|
+
export JAVACMD=/usr/lib/jvm/java-1.8.0/bin/java
|
|
17
|
+
#export PATH=$PATH:/usr/lib/jvm/java-1.8.0/bin
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if true; then
|
|
21
|
+
# newer
|
|
22
|
+
# rhel71-ppc, https://jira.mongodb.org/browse/BUILD-9231
|
|
23
|
+
if test -z "$JAVACMD" &&
|
|
24
|
+
(ls /opt/java || true) |grep -q java-1.8.0-openjdk-1.8.0 &&
|
|
25
|
+
test -f /opt/java/java-1.8.0-openjdk-1.8.0*/bin/java;
|
|
26
|
+
then
|
|
27
|
+
path=$(cd /opt/java && ls -d java-1.8.0-openjdk-1.8.0* |head -n 1)
|
|
28
|
+
export JAVACMD=/opt/java/"$path"/bin/java
|
|
29
|
+
fi
|
|
11
30
|
else
|
|
12
|
-
|
|
31
|
+
# older
|
|
32
|
+
# rhel71-ppc seems to have an /opt/java/jdk8/bin/java but it doesn't work
|
|
33
|
+
if test -n "$JAVACMD" && ! exec $JAVACMD -version; then
|
|
34
|
+
JAVACMD=
|
|
35
|
+
# we will try the /usr/lib/jvm then
|
|
36
|
+
fi
|
|
13
37
|
fi
|
|
14
38
|
|
|
15
39
|
if test -n "$JAVACMD"; then
|
|
@@ -29,7 +53,7 @@ set_env_python() {
|
|
|
29
53
|
curl -fL --retry 3 https://github.com/p-mongodb/deps/raw/main/"$arch"-python37.tar.xz | \
|
|
30
54
|
tar xfJ - -C /opt
|
|
31
55
|
fi
|
|
32
|
-
|
|
56
|
+
|
|
33
57
|
if test -d /opt/python/3.7/bin; then
|
|
34
58
|
# Most Evergreen configurations.
|
|
35
59
|
export PATH=/opt/python/3.7/bin:$PATH
|
|
@@ -37,7 +61,7 @@ set_env_python() {
|
|
|
37
61
|
# Configurations that use Docker in Evergreen - these don't preload.
|
|
38
62
|
export PATH=/opt/python37/bin:$PATH
|
|
39
63
|
fi
|
|
40
|
-
|
|
64
|
+
|
|
41
65
|
python3 -V
|
|
42
66
|
fi
|
|
43
67
|
}
|
|
@@ -54,7 +78,7 @@ set_env_node() {
|
|
|
54
78
|
# Node from toolchain in Evergreen
|
|
55
79
|
export PATH=/opt/node/bin:$PATH
|
|
56
80
|
fi
|
|
57
|
-
|
|
81
|
+
|
|
58
82
|
node -v
|
|
59
83
|
}
|
|
60
84
|
|
|
@@ -89,13 +113,34 @@ set_env_ruby() {
|
|
|
89
113
|
if test "$USE_OPT_TOOLCHAIN" = 1; then
|
|
90
114
|
# Nothing, also PATH is already set
|
|
91
115
|
:
|
|
116
|
+
elif true; then
|
|
117
|
+
|
|
118
|
+
# For testing toolchains:
|
|
119
|
+
#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
|
|
120
|
+
toolchain_url=http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/$TOOLCHAIN_VERSION/`host_distro`/$RVM_RUBY.tar.xz
|
|
121
|
+
curl --retry 3 -fL $toolchain_url |tar Jxf -
|
|
122
|
+
export PATH=`pwd`/rubies/$RVM_RUBY/bin:$PATH
|
|
123
|
+
#export PATH=`pwd`/rubies/python/3/bin:$PATH
|
|
124
|
+
|
|
125
|
+
# Attempt to get bundler to report all errors - so far unsuccessful
|
|
126
|
+
#curl --retry 3 -o bundler-openssl.diff https://github.com/bundler/bundler/compare/v2.0.1...p-mongo:report-errors.diff
|
|
127
|
+
#find . -path \*/lib/bundler/fetcher.rb -exec patch {} bundler-openssl.diff \;
|
|
128
|
+
|
|
92
129
|
else
|
|
93
|
-
# For testing unpublished builds:
|
|
94
|
-
#build_url=https://s3.amazonaws.com/mciuploads/mongo-ruby-toolchain/library/`host_distro`/$RVM_RUBY.tar.xz
|
|
95
130
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
131
|
+
# Normal operation
|
|
132
|
+
if ! test -d $HOME/.rubies/$RVM_RUBY/bin; then
|
|
133
|
+
echo "Ruby directory does not exist: $HOME/.rubies/$RVM_RUBY/bin" 1>&2
|
|
134
|
+
echo "Contents of /opt:" 1>&2
|
|
135
|
+
ls -l /opt 1>&2 || true
|
|
136
|
+
echo ".rubies symlink:" 1>&2
|
|
137
|
+
ls -ld $HOME/.rubies 1>&2 || true
|
|
138
|
+
echo "Our rubies:" 1>&2
|
|
139
|
+
ls -l $HOME/.rubies 1>&2 || true
|
|
140
|
+
exit 2
|
|
141
|
+
fi
|
|
142
|
+
export PATH=$HOME/.rubies/$RVM_RUBY/bin:$PATH
|
|
143
|
+
|
|
99
144
|
fi
|
|
100
145
|
|
|
101
146
|
ruby --version
|
|
@@ -106,5 +151,19 @@ set_env_ruby() {
|
|
|
106
151
|
|
|
107
152
|
ruby -v |fgrep $ruby_name
|
|
108
153
|
ruby -v |fgrep $ruby_version
|
|
154
|
+
|
|
155
|
+
# We shouldn't need to update rubygems, and there is value in
|
|
156
|
+
# testing on whatever rubygems came with each supported ruby version
|
|
157
|
+
#echo 'updating rubygems'
|
|
158
|
+
#gem update --system
|
|
159
|
+
|
|
160
|
+
# Only install bundler when not using ruby-head.
|
|
161
|
+
# ruby-head comes with bundler and gem complains
|
|
162
|
+
# because installing bundler would overwrite the bundler binary.
|
|
163
|
+
# We now install bundler in the toolchain, hence nothing needs to be done
|
|
164
|
+
# in the tests.
|
|
165
|
+
if false && echo "$RVM_RUBY" |grep -q jruby; then
|
|
166
|
+
gem install bundler -v '<2'
|
|
167
|
+
fi
|
|
109
168
|
fi
|
|
110
169
|
}
|
data/spec/support/constraints.rb
CHANGED
|
@@ -27,6 +27,30 @@ module Constraints
|
|
|
27
27
|
Mongo::VERSION.split('.')[0...precision].map(&:to_i)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
def min_bson_version(version)
|
|
31
|
+
required_version = version.split('.').map(&:to_i)
|
|
32
|
+
actual_version = bson_version(required_version.length)
|
|
33
|
+
before(:all) do
|
|
34
|
+
if (actual_version <=> required_version) < 0
|
|
35
|
+
skip "bson-ruby version #{version} or higher is required"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def max_bson_version(version)
|
|
41
|
+
required_version = version.split('.').map(&:to_i)
|
|
42
|
+
actual_version = bson_version(required_version.length)
|
|
43
|
+
before(:all) do
|
|
44
|
+
if (actual_version <=> required_version) > 0
|
|
45
|
+
skip "bson-ruby version #{version} or lower is required"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def bson_version(precision)
|
|
51
|
+
BSON::VERSION.split('.')[0...precision].map(&:to_i)
|
|
52
|
+
end
|
|
53
|
+
|
|
30
54
|
def min_rails_version(version)
|
|
31
55
|
unless version =~ /\A\d+\.\d+\z/
|
|
32
56
|
raise ArgumentError, "Version can only be major.minor: #{version}"
|
|
@@ -2,30 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
module Mongoid
|
|
4
4
|
module Expectations
|
|
5
|
-
# Previously this method used RSpec::Mocks with .exactly.times(n).and_call_original,
|
|
6
|
-
# which stopped working reliably in Ruby 3.3. Now we directly wrap the target method.
|
|
7
|
-
def expect_query(number)
|
|
8
|
-
if %i[ sharded load-balanced ].include?(ClusterConfig.instance.topology) && number > 0
|
|
9
|
-
skip 'This spec requires replica set or standalone topology'
|
|
10
|
-
end
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
def connection_class
|
|
7
|
+
if defined?(Mongo::Server::ConnectionBase)
|
|
8
|
+
Mongo::Server::ConnectionBase
|
|
9
|
+
else
|
|
10
|
+
# Pre-2.8 drivers
|
|
11
|
+
Mongo::Server::Connection
|
|
12
|
+
end
|
|
13
|
+
end
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
def expect_query(number)
|
|
16
|
+
rv = nil
|
|
17
|
+
RSpec::Mocks.with_temporary_scope do
|
|
18
|
+
if number > 0
|
|
19
|
+
expect_any_instance_of(connection_class).to receive(:command_started).exactly(number).times.and_call_original
|
|
20
|
+
else
|
|
21
|
+
expect_any_instance_of(connection_class).not_to receive(:command_started)
|
|
20
22
|
end
|
|
21
|
-
|
|
22
|
-
result = yield
|
|
23
|
-
expect(query_count).to eq(number)
|
|
24
|
-
result
|
|
25
|
-
ensure
|
|
26
|
-
klass.remove_method(:command_started)
|
|
27
|
-
klass.define_method(:command_started, original_method)
|
|
23
|
+
rv = yield
|
|
28
24
|
end
|
|
25
|
+
rv
|
|
29
26
|
end
|
|
30
27
|
|
|
31
28
|
def expect_no_queries(&block)
|