mongoid 7.2.4 → 7.3.0
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 +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +1 -1
- data/Rakefile +16 -0
- data/lib/config/locales/en.yml +2 -2
- data/lib/mongoid/association/accessors.rb +1 -1
- data/lib/mongoid/association/constrainable.rb +1 -1
- data/lib/mongoid/association/depending.rb +4 -4
- data/lib/mongoid/association/embedded/batchable.rb +1 -1
- data/lib/mongoid/association/embedded/embedded_in.rb +1 -1
- data/lib/mongoid/association/embedded/embeds_many/proxy.rb +10 -3
- data/lib/mongoid/association/nested/many.rb +1 -1
- data/lib/mongoid/association/nested/one.rb +4 -2
- data/lib/mongoid/association/proxy.rb +6 -1
- data/lib/mongoid/association/referenced/auto_save.rb +2 -2
- data/lib/mongoid/association/referenced/has_many/enumerable.rb +493 -495
- data/lib/mongoid/association/referenced/has_many/proxy.rb +2 -2
- data/lib/mongoid/association/referenced/has_one/nested_builder.rb +2 -2
- data/lib/mongoid/attributes.rb +24 -13
- data/lib/mongoid/attributes/projector.rb +120 -0
- data/lib/mongoid/cacheable.rb +2 -2
- data/lib/mongoid/clients.rb +1 -1
- data/lib/mongoid/clients/factory.rb +22 -8
- data/lib/mongoid/config.rb +19 -2
- data/lib/mongoid/contextual/aggregable/mongo.rb +10 -8
- data/lib/mongoid/copyable.rb +1 -1
- data/lib/mongoid/criteria.rb +4 -5
- data/lib/mongoid/criteria/findable.rb +1 -1
- data/lib/mongoid/criteria/queryable/expandable.rb +0 -24
- data/lib/mongoid/criteria/queryable/extensions.rb +0 -4
- data/lib/mongoid/criteria/queryable/extensions/boolean.rb +1 -1
- data/lib/mongoid/criteria/queryable/mergeable.rb +46 -20
- data/lib/mongoid/criteria/queryable/selectable.rb +8 -8
- data/lib/mongoid/document.rb +1 -15
- data/lib/mongoid/errors/delete_restriction.rb +8 -9
- data/lib/mongoid/errors/mongoid_error.rb +1 -1
- data/lib/mongoid/evolvable.rb +1 -1
- data/lib/mongoid/extensions/boolean.rb +1 -2
- data/lib/mongoid/extensions/false_class.rb +1 -1
- data/lib/mongoid/extensions/hash.rb +2 -2
- data/lib/mongoid/extensions/true_class.rb +1 -1
- data/lib/mongoid/fields.rb +43 -5
- data/lib/mongoid/inspectable.rb +1 -1
- data/lib/mongoid/matcher.rb +7 -0
- data/lib/mongoid/matcher/bits.rb +41 -0
- data/lib/mongoid/matcher/bits_all_clear.rb +20 -0
- data/lib/mongoid/matcher/bits_all_set.rb +20 -0
- data/lib/mongoid/matcher/bits_any_clear.rb +20 -0
- data/lib/mongoid/matcher/bits_any_set.rb +20 -0
- data/lib/mongoid/matcher/expression.rb +4 -0
- data/lib/mongoid/matcher/field_operator.rb +6 -0
- data/lib/mongoid/matcher/mod.rb +17 -0
- data/lib/mongoid/matcher/type.rb +99 -0
- data/lib/mongoid/persistable/deletable.rb +1 -2
- data/lib/mongoid/persistable/destroyable.rb +8 -2
- data/lib/mongoid/persistable/updatable.rb +27 -2
- data/lib/mongoid/query_cache.rb +35 -29
- data/lib/mongoid/selectable.rb +5 -7
- data/lib/mongoid/shardable.rb +21 -5
- data/lib/mongoid/touchable.rb +23 -4
- data/lib/mongoid/validatable/associated.rb +1 -1
- data/lib/mongoid/validatable/presence.rb +3 -3
- data/lib/mongoid/validatable/uniqueness.rb +1 -1
- data/lib/mongoid/version.rb +1 -1
- data/lib/rails/generators/mongoid/config/templates/mongoid.yml +1 -1
- data/spec/integration/app_spec.rb +0 -3
- data/spec/integration/associations/embeds_many_spec.rb +44 -0
- data/spec/integration/associations/has_one_spec.rb +48 -0
- data/spec/integration/criteria/date_field_spec.rb +1 -1
- data/spec/integration/document_spec.rb +9 -0
- data/spec/integration/matcher_operator_data/bits_all_clear.yml +159 -0
- data/spec/integration/matcher_operator_data/bits_all_set.yml +159 -0
- data/spec/integration/matcher_operator_data/bits_any_clear.yml +159 -0
- data/spec/integration/matcher_operator_data/bits_any_set.yml +159 -0
- data/spec/integration/matcher_operator_data/comment.yml +22 -0
- data/spec/integration/matcher_operator_data/in.yml +16 -0
- data/spec/integration/matcher_operator_data/mod.yml +55 -0
- data/spec/integration/matcher_operator_data/type.yml +70 -0
- data/spec/integration/matcher_operator_data/type_array.yml +16 -0
- data/spec/integration/matcher_operator_data/type_binary.yml +18 -0
- data/spec/integration/matcher_operator_data/type_boolean.yml +39 -0
- data/spec/integration/matcher_operator_data/type_code.yml +26 -0
- data/spec/integration/matcher_operator_data/type_code_with_scope.yml +26 -0
- data/spec/integration/matcher_operator_data/type_date.yml +39 -0
- data/spec/integration/matcher_operator_data/type_db_pointer.yml +19 -0
- data/spec/integration/matcher_operator_data/type_decimal.yml +40 -0
- data/spec/integration/matcher_operator_data/type_double.yml +15 -0
- data/spec/integration/matcher_operator_data/type_int32.yml +33 -0
- data/spec/integration/matcher_operator_data/type_int64.yml +33 -0
- data/spec/integration/matcher_operator_data/type_max_key.yml +17 -0
- data/spec/integration/matcher_operator_data/type_min_key.yml +17 -0
- data/spec/integration/matcher_operator_data/type_null.yml +23 -0
- data/spec/integration/matcher_operator_data/type_object.yml +23 -0
- data/spec/integration/matcher_operator_data/type_object_id.yml +25 -0
- data/spec/integration/matcher_operator_data/type_regex.yml +44 -0
- data/spec/integration/matcher_operator_data/type_string.yml +15 -0
- data/spec/integration/matcher_operator_data/type_symbol.yml +32 -0
- data/spec/integration/matcher_operator_data/type_timestamp.yml +25 -0
- data/spec/integration/matcher_operator_data/type_undefined.yml +17 -0
- data/spec/lite_spec_helper.rb +2 -0
- data/spec/mongoid/association/depending_spec.rb +391 -352
- data/spec/mongoid/association/nested/one_spec.rb +18 -14
- data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +25 -8
- data/spec/mongoid/association/referenced/has_and_belongs_to_many/binding_spec.rb +1 -1
- data/spec/mongoid/association/referenced/has_many/binding_spec.rb +1 -1
- data/spec/mongoid/association/referenced/has_many/enumerable_spec.rb +1 -1
- data/spec/mongoid/association/referenced/has_one_models.rb +8 -0
- data/spec/mongoid/atomic/paths_spec.rb +64 -12
- data/spec/mongoid/attributes/projector_data/embedded.yml +105 -0
- data/spec/mongoid/attributes/projector_data/fields.yml +93 -0
- data/spec/mongoid/attributes/projector_spec.rb +41 -0
- data/spec/mongoid/attributes_spec.rb +98 -6
- data/spec/mongoid/clients/factory_spec.rb +48 -0
- data/spec/mongoid/config_spec.rb +32 -0
- data/spec/mongoid/contextual/mongo_spec.rb +2 -2
- data/spec/mongoid/criteria/modifiable_spec.rb +1 -1
- data/spec/mongoid/criteria/queryable/expandable_spec.rb +0 -73
- data/spec/mongoid/criteria/queryable/extensions/boolean_spec.rb +1 -1
- data/spec/mongoid/criteria/queryable/mergeable_spec.rb +105 -7
- data/spec/mongoid/criteria/queryable/selectable_logical_spec.rb +229 -24
- data/spec/mongoid/criteria/queryable/selectable_shared_examples.rb +39 -0
- data/spec/mongoid/criteria/queryable/selectable_spec.rb +1 -565
- data/spec/mongoid/criteria/queryable/selectable_where_spec.rb +590 -0
- data/spec/mongoid/criteria_projection_spec.rb +411 -0
- data/spec/mongoid/criteria_spec.rb +0 -275
- data/spec/mongoid/document_query_spec.rb +0 -51
- data/spec/mongoid/document_spec.rb +13 -13
- data/spec/mongoid/errors/delete_restriction_spec.rb +1 -1
- data/spec/mongoid/errors/mongoid_error_spec.rb +8 -20
- data/spec/mongoid/extensions/false_class_spec.rb +1 -1
- data/spec/mongoid/extensions/string_spec.rb +5 -5
- data/spec/mongoid/extensions/true_class_spec.rb +1 -1
- data/spec/mongoid/fields/localized_spec.rb +4 -4
- data/spec/mongoid/fields_spec.rb +4 -4
- data/spec/mongoid/inspectable_spec.rb +12 -4
- data/spec/mongoid/persistable/deletable_spec.rb +175 -1
- data/spec/mongoid/persistable/destroyable_spec.rb +191 -3
- data/spec/mongoid/persistable/savable_spec.rb +3 -5
- data/spec/mongoid/persistable/upsertable_spec.rb +1 -1
- data/spec/mongoid/persistable_spec.rb +2 -2
- data/spec/mongoid/query_cache_middleware_spec.rb +8 -0
- data/spec/mongoid/reloadable_spec.rb +18 -1
- data/spec/mongoid/shardable_spec.rb +44 -0
- data/spec/mongoid/touchable_spec.rb +104 -16
- data/spec/mongoid/touchable_spec_models.rb +52 -0
- data/spec/mongoid/validatable_spec.rb +1 -1
- data/spec/shared/lib/mrss/cluster_config.rb +3 -8
- data/spec/shared/lib/mrss/constraints.rb +6 -20
- data/spec/shared/lib/mrss/docker_runner.rb +1 -7
- data/spec/shared/lib/mrss/spec_organizer.rb +1 -18
- data/spec/shared/share/Dockerfile.erb +30 -121
- data/spec/shared/shlib/server.sh +4 -31
- data/spec/shared/shlib/set_env.sh +1 -4
- data/spec/spec_helper.rb +7 -3
- data/spec/support/client_registry.rb +9 -0
- data/spec/support/models/bolt.rb +8 -0
- data/spec/support/models/hole.rb +13 -0
- data/spec/support/models/mop.rb +0 -1
- data/spec/support/models/nut.rb +8 -0
- data/spec/support/models/person.rb +6 -0
- data/spec/support/models/sealer.rb +8 -0
- data/spec/support/models/shirt.rb +12 -0
- data/spec/support/models/spacer.rb +8 -0
- data/spec/support/models/threadlocker.rb +8 -0
- data/spec/support/models/washer.rb +8 -0
- metadata +620 -534
- metadata.gz.sig +5 -3
- data/spec/shared/bin/s3-copy +0 -45
- data/spec/shared/bin/s3-upload +0 -69
- data/spec/shared/share/haproxy-1.conf +0 -16
- data/spec/shared/share/haproxy-2.conf +0 -17
- data/spec/support/cluster_config.rb +0 -158
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
module TouchableSpec
|
|
5
|
+
module Embedded
|
|
6
|
+
class Building
|
|
7
|
+
include Mongoid::Document
|
|
8
|
+
include Mongoid::Timestamps
|
|
9
|
+
|
|
10
|
+
embeds_many :entrances
|
|
11
|
+
embeds_many :floors
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Entrance
|
|
15
|
+
include Mongoid::Document
|
|
16
|
+
include Mongoid::Timestamps
|
|
17
|
+
|
|
18
|
+
embedded_in :building
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Floor
|
|
22
|
+
include Mongoid::Document
|
|
23
|
+
include Mongoid::Timestamps
|
|
24
|
+
|
|
25
|
+
embedded_in :building, touch: true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
module Referenced
|
|
30
|
+
class Building
|
|
31
|
+
include Mongoid::Document
|
|
32
|
+
include Mongoid::Timestamps
|
|
33
|
+
|
|
34
|
+
has_many :entrances, inverse_of: :building
|
|
35
|
+
has_many :floors, inverse_of: :building
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class Entrance
|
|
39
|
+
include Mongoid::Document
|
|
40
|
+
include Mongoid::Timestamps
|
|
41
|
+
|
|
42
|
+
belongs_to :building
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class Floor
|
|
46
|
+
include Mongoid::Document
|
|
47
|
+
include Mongoid::Timestamps
|
|
48
|
+
|
|
49
|
+
belongs_to :building, touch: true
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -15,11 +15,6 @@ module Mrss
|
|
|
15
15
|
@single_server
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def sharded_ish?
|
|
19
|
-
determine_cluster_config
|
|
20
|
-
@topology == :sharded || @topology == :load_balanced
|
|
21
|
-
end
|
|
22
|
-
|
|
23
18
|
def replica_set_name
|
|
24
19
|
determine_cluster_config
|
|
25
20
|
@replica_set_name
|
|
@@ -53,7 +48,7 @@ module Mrss
|
|
|
53
48
|
raise "Deployment server version not known - check that connection to deployment succeeded"
|
|
54
49
|
end
|
|
55
50
|
|
|
56
|
-
if server_version >= '3.4' &&
|
|
51
|
+
if server_version >= '3.4' && topology != :sharded
|
|
57
52
|
fcv
|
|
58
53
|
else
|
|
59
54
|
if short_server_version == '4.1'
|
|
@@ -120,7 +115,7 @@ module Mrss
|
|
|
120
115
|
:mmapv1
|
|
121
116
|
else
|
|
122
117
|
client = ClientRegistry.instance.global_client('root_authorized')
|
|
123
|
-
if
|
|
118
|
+
if topology == :sharded
|
|
124
119
|
shards = client.use(:admin).command(listShards: 1).first
|
|
125
120
|
if shards['shards'].empty?
|
|
126
121
|
raise 'Shards are empty'
|
|
@@ -211,7 +206,7 @@ module Mrss
|
|
|
211
206
|
|
|
212
207
|
@server_parameters = client.use(:admin).command(getParameter: '*').first
|
|
213
208
|
|
|
214
|
-
if
|
|
209
|
+
if @topology != :sharded && short_server_version >= '3.4'
|
|
215
210
|
rv = @server_parameters['featureCompatibilityVersion']
|
|
216
211
|
@fcv = rv['version'] || rv
|
|
217
212
|
end
|
|
@@ -52,7 +52,7 @@ module Mrss
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def require_topology(*topologies)
|
|
55
|
-
invalid_topologies = topologies - [:single, :replica_set, :sharded
|
|
55
|
+
invalid_topologies = topologies - [:single, :replica_set, :sharded]
|
|
56
56
|
|
|
57
57
|
unless invalid_topologies.empty?
|
|
58
58
|
raise ArgumentError, "Invalid topologies requested: #{invalid_topologies.join(', ')}"
|
|
@@ -82,7 +82,7 @@ module Mrss
|
|
|
82
82
|
unless ClusterConfig.instance.server_version >= '4.0'
|
|
83
83
|
skip 'Transactions tests in a replica set topology require server 4.0+'
|
|
84
84
|
end
|
|
85
|
-
when :sharded
|
|
85
|
+
when :sharded
|
|
86
86
|
unless ClusterConfig.instance.server_version >= '4.2'
|
|
87
87
|
skip 'Transactions tests in a sharded cluster topology require server 4.2+'
|
|
88
88
|
end
|
|
@@ -249,9 +249,7 @@ module Mrss
|
|
|
249
249
|
# (mongos 4.0+ overrides the write concern)
|
|
250
250
|
def require_set_write_concern
|
|
251
251
|
before(:all) do
|
|
252
|
-
if
|
|
253
|
-
ClusterConfig.instance.short_server_version >= '4.0'
|
|
254
|
-
then
|
|
252
|
+
if ClusterConfig.instance.topology == :sharded && ClusterConfig.instance.short_server_version >= '4.0'
|
|
255
253
|
skip "mongos 4.0+ overrides write concern"
|
|
256
254
|
end
|
|
257
255
|
end
|
|
@@ -275,9 +273,7 @@ module Mrss
|
|
|
275
273
|
|
|
276
274
|
def require_wired_tiger
|
|
277
275
|
before(:all) do
|
|
278
|
-
|
|
279
|
-
# assume that a serverless instance uses WiredTiger Storage Engine.
|
|
280
|
-
if !SpecConfig.instance.serverless? && ClusterConfig.instance.storage_engine != :wired_tiger
|
|
276
|
+
if ClusterConfig.instance.storage_engine != :wired_tiger
|
|
281
277
|
skip 'Test requires WiredTiger storage engine'
|
|
282
278
|
end
|
|
283
279
|
end
|
|
@@ -286,9 +282,7 @@ module Mrss
|
|
|
286
282
|
def require_wired_tiger_on_36
|
|
287
283
|
before(:all) do
|
|
288
284
|
if ClusterConfig.instance.short_server_version >= '3.6'
|
|
289
|
-
|
|
290
|
-
# assume that a serverless instance uses WiredTiger Storage Engine.
|
|
291
|
-
if !SpecConfig.instance.serverless? && ClusterConfig.instance.storage_engine != :wired_tiger
|
|
285
|
+
if ClusterConfig.instance.storage_engine != :wired_tiger
|
|
292
286
|
skip 'Test requires WiredTiger storage engine on 3.6+ servers'
|
|
293
287
|
end
|
|
294
288
|
end
|
|
@@ -297,7 +291,7 @@ module Mrss
|
|
|
297
291
|
|
|
298
292
|
def require_mmapv1
|
|
299
293
|
before(:all) do
|
|
300
|
-
if
|
|
294
|
+
if ClusterConfig.instance.storage_engine != :mmapv1
|
|
301
295
|
skip 'Test requires MMAPv1 storage engine'
|
|
302
296
|
end
|
|
303
297
|
end
|
|
@@ -356,13 +350,5 @@ module Mrss
|
|
|
356
350
|
end
|
|
357
351
|
end
|
|
358
352
|
end
|
|
359
|
-
|
|
360
|
-
def require_unix_socket
|
|
361
|
-
before(:all) do
|
|
362
|
-
if ENV['TOPOLOGY'] == 'load-balanced'
|
|
363
|
-
skip 'Load balancer does not listen on Unix sockets'
|
|
364
|
-
end
|
|
365
|
-
end
|
|
366
|
-
end
|
|
367
353
|
end
|
|
368
354
|
end
|
|
@@ -111,7 +111,7 @@ module Mrss
|
|
|
111
111
|
'.'])
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
BASE_TEST_COMMAND = %w(docker run
|
|
114
|
+
BASE_TEST_COMMAND = %w(docker run -i --tmpfs /tmpfs:exec).freeze
|
|
115
115
|
|
|
116
116
|
def run_tests
|
|
117
117
|
run_command(BASE_TEST_COMMAND + tty_arg + extra_env + [image_tag] +
|
|
@@ -179,11 +179,9 @@ module Mrss
|
|
|
179
179
|
BASE_IMAGES = {
|
|
180
180
|
'debian81' => 'debian:jessie',
|
|
181
181
|
'debian92' => 'debian:stretch',
|
|
182
|
-
'debian10' => 'debian:buster',
|
|
183
182
|
'ubuntu1404' => 'ubuntu:trusty',
|
|
184
183
|
'ubuntu1604' => 'ubuntu:xenial',
|
|
185
184
|
'ubuntu1804' => 'ubuntu:bionic',
|
|
186
|
-
'ubuntu2004' => 'ubuntu:focal',
|
|
187
185
|
'rhel62' => 'centos:6',
|
|
188
186
|
'rhel70' => 'centos:7',
|
|
189
187
|
}.freeze
|
|
@@ -200,10 +198,6 @@ module Mrss
|
|
|
200
198
|
ruby == 'ruby-head'
|
|
201
199
|
end
|
|
202
200
|
|
|
203
|
-
def system_ruby?
|
|
204
|
-
%w(1 true yes).include?(@env['SYSTEM_RUBY']&.downcase)
|
|
205
|
-
end
|
|
206
|
-
|
|
207
201
|
def server_version
|
|
208
202
|
@env['MONGODB_VERSION']
|
|
209
203
|
end
|
|
@@ -25,28 +25,18 @@ module Mrss
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def initialize(root: nil, classifiers:, priority_order:,
|
|
28
|
-
spec_root: nil, rspec_json_path: nil, rspec_all_json_path: nil
|
|
29
|
-
randomize: false
|
|
28
|
+
spec_root: nil, rspec_json_path: nil, rspec_all_json_path: nil
|
|
30
29
|
)
|
|
31
30
|
@spec_root = spec_root || File.join(root, 'spec')
|
|
32
31
|
@classifiers = classifiers
|
|
33
32
|
@priority_order = priority_order
|
|
34
33
|
@rspec_json_path = rspec_json_path || File.join(root, 'tmp/rspec.json')
|
|
35
34
|
@rspec_all_json_path = rspec_all_json_path || File.join(root, 'tmp/rspec-all.json')
|
|
36
|
-
@randomize = !!randomize
|
|
37
35
|
end
|
|
38
36
|
|
|
39
37
|
attr_reader :spec_root, :classifiers, :priority_order
|
|
40
38
|
attr_reader :rspec_json_path, :rspec_all_json_path
|
|
41
39
|
|
|
42
|
-
def randomize?
|
|
43
|
-
@randomize
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def seed
|
|
47
|
-
@seed ||= (rand * 100_000).to_i
|
|
48
|
-
end
|
|
49
|
-
|
|
50
40
|
def buckets
|
|
51
41
|
@buckets ||= {}.tap do |buckets|
|
|
52
42
|
Find.find(spec_root) do |path|
|
|
@@ -132,12 +122,8 @@ module Mrss
|
|
|
132
122
|
puts "Running #{category.to_s.gsub('_', ' ')} tests"
|
|
133
123
|
FileUtils.rm_f(rspec_json_path)
|
|
134
124
|
cmd = %w(rspec) + paths
|
|
135
|
-
if randomize?
|
|
136
|
-
cmd += %W(--order rand:#{seed})
|
|
137
|
-
end
|
|
138
125
|
|
|
139
126
|
begin
|
|
140
|
-
puts "Running #{cmd.join(' ')}"
|
|
141
127
|
ChildProcessHelper.check_call(cmd)
|
|
142
128
|
ensure
|
|
143
129
|
if File.exist?(rspec_json_path)
|
|
@@ -163,9 +149,6 @@ module Mrss
|
|
|
163
149
|
end
|
|
164
150
|
new.delete('version')
|
|
165
151
|
new.delete('summary_line')
|
|
166
|
-
# The spec organizer runs all buckets with the same seed, hence
|
|
167
|
-
# we can drop the seed from new results.
|
|
168
|
-
new.delete('seed')
|
|
169
152
|
unless new.empty?
|
|
170
153
|
raise "Unhandled rspec results keys: #{new.keys.join(', ')}"
|
|
171
154
|
end
|
|
@@ -58,7 +58,6 @@ FROM <%= base_image %>
|
|
|
58
58
|
# JRuby: openjdk-8-jre-headless
|
|
59
59
|
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
|
60
60
|
# Determining OS we are running on: lsb-release
|
|
61
|
-
# Load balancer testing: haproxy
|
|
62
61
|
# Kerberos testing: krb5-user
|
|
63
62
|
# Local Kerberos server: krb5-kdc krb5-admin-server
|
|
64
63
|
# Installing mlaunch from git: git
|
|
@@ -77,42 +76,20 @@ FROM <%= base_image %>
|
|
|
77
76
|
<% packages = %w(
|
|
78
77
|
lsb-release bzip2 curl zsh
|
|
79
78
|
git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
|
|
79
|
+
libsnmp30
|
|
80
80
|
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
|
81
|
-
|
|
82
|
-
python3-pip
|
|
81
|
+
python-pip python2.7-dev python3-pip
|
|
83
82
|
tzdata shared-mime-info
|
|
84
83
|
) %>
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<% packages += %w(libssl-dev unzip) %>
|
|
89
|
-
<% end %>
|
|
90
|
-
|
|
91
|
-
<% if distro !~ /ubuntu2004/ %>
|
|
92
|
-
<% packages += %w(python2.7-dev) %>
|
|
93
|
-
<% end %>
|
|
94
|
-
|
|
95
|
-
<% if distro =~ /ubuntu2004/ %>
|
|
96
|
-
<% packages << 'libsnmp35' %>
|
|
97
|
-
<% else %>
|
|
98
|
-
<% packages << 'libsnmp30' %>
|
|
99
|
-
<% end %>
|
|
100
|
-
|
|
101
|
-
<% if distro !~ /ubuntu2004/ %>
|
|
102
|
-
<% packages << 'python-pip' %>
|
|
103
|
-
<% end %>
|
|
104
|
-
|
|
105
|
-
<% if distro =~ /debian10/ %>
|
|
106
|
-
<% packages << 'openjdk-11-jre-headless' %>
|
|
107
|
-
<% elsif distro =~ /ubuntu1404/ %>
|
|
108
|
-
# Ubuntu 14.04 only has openjdk 7, this is too old to be useful
|
|
109
|
-
<% else %>
|
|
85
|
+
# ubuntu1404 only has openjdk-7-jre-headless
|
|
86
|
+
<% if distro !~ /ubuntu1404/ %>
|
|
110
87
|
<% packages << 'openjdk-8-jre-headless' %>
|
|
111
88
|
<% end %>
|
|
112
89
|
|
|
113
90
|
# ubuntu1404, ubuntu1604: libcurl3
|
|
114
|
-
# ubuntu1804
|
|
115
|
-
<% if distro =~ /ubuntu1804
|
|
91
|
+
# ubuntu1804: libcurl4
|
|
92
|
+
<% if distro =~ /ubuntu1804/ %>
|
|
116
93
|
<% packages << 'libcurl4' %>
|
|
117
94
|
<% else %>
|
|
118
95
|
<% packages << 'libcurl3' %>
|
|
@@ -122,36 +99,9 @@ FROM <%= base_image %>
|
|
|
122
99
|
<% packages << 'nodejs' %>
|
|
123
100
|
<% end %>
|
|
124
101
|
|
|
125
|
-
<% if distro =~ /ubuntu2004/ %>
|
|
126
|
-
<% packages += %w(ruby ruby2.7 bundler python2 python2-dev) %>
|
|
127
|
-
<% end %>
|
|
128
|
-
|
|
129
102
|
RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
|
|
130
103
|
<% else %>
|
|
131
104
|
|
|
132
|
-
<% if distro =~ /rhel6/ %>
|
|
133
|
-
|
|
134
|
-
# CentOS 6 is dead - to use it retrieve the packages from vault:
|
|
135
|
-
# https://stackoverflow.com/questions/53562691/error-cannot-retrieve-repository-metadata-repomd-xml-for-repository-base-pl
|
|
136
|
-
|
|
137
|
-
<%
|
|
138
|
-
|
|
139
|
-
cfg = <<-CFG
|
|
140
|
-
[base]
|
|
141
|
-
name=CentOS-$releasever - Base
|
|
142
|
-
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
|
|
143
|
-
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
|
|
144
|
-
baseurl=http://vault.centos.org/6.10/os/x86_64/
|
|
145
|
-
gpgcheck=1
|
|
146
|
-
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
|
147
|
-
CFG
|
|
148
|
-
|
|
149
|
-
%>
|
|
150
|
-
|
|
151
|
-
RUN printf "<%= cfg.gsub("\n", "\\n") %>" >/etc/yum.repos.d/CentOS-Base.repo
|
|
152
|
-
|
|
153
|
-
<% end %>
|
|
154
|
-
|
|
155
105
|
# Enterprise server: net-snmp
|
|
156
106
|
# lsb_release: redhat-lsb-core
|
|
157
107
|
# our runner scripts: which
|
|
@@ -168,7 +118,7 @@ CFG
|
|
|
168
118
|
|
|
169
119
|
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
|
|
170
120
|
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
|
|
171
|
-
net-snmp
|
|
121
|
+
net-snmp
|
|
172
122
|
|
|
173
123
|
<% if distro =~ /rhel6/ %>
|
|
174
124
|
|
|
@@ -184,69 +134,23 @@ CFG
|
|
|
184
134
|
RUN yum install -y python-devel
|
|
185
135
|
|
|
186
136
|
<% end %>
|
|
187
|
-
|
|
137
|
+
|
|
188
138
|
<% end %>
|
|
189
139
|
|
|
190
140
|
<% if preload? %>
|
|
191
141
|
|
|
192
|
-
<% if distro =~ /ubuntu1404/ %>
|
|
193
|
-
|
|
194
|
-
# I couldn't find a prebuilt package of anything more recent than 2.7.6
|
|
195
|
-
# for 14.04.
|
|
196
|
-
RUN curl --retry 3 -fL https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz | \
|
|
197
|
-
tar xfJ - && \
|
|
198
|
-
cd Python-2.7.16 && \
|
|
199
|
-
./configure && \
|
|
200
|
-
nice make -j4 && \
|
|
201
|
-
make install && \
|
|
202
|
-
cd .. && rm -rf Python-2.7.16
|
|
203
|
-
|
|
204
|
-
ENV PATH=/usr/local/bin:$PATH
|
|
205
|
-
|
|
206
|
-
RUN curl --retry 3 -fL -o setuptools-44.1.1.zip https://files.pythonhosted.org/packages/b2/40/4e00501c204b457f10fe410da0c97537214b2265247bc9a5bc6edd55b9e4/setuptools-44.1.1.zip && \
|
|
207
|
-
unzip setuptools-44.1.1.zip && \
|
|
208
|
-
cd setuptools-44.1.1 && \
|
|
209
|
-
python setup.py install && \
|
|
210
|
-
cd .. && rm -rf setuptools-44.1.1
|
|
211
|
-
|
|
212
|
-
<% end%>
|
|
213
|
-
|
|
214
|
-
<% if true || distro =~ /rhel|ubuntu1604/ %>
|
|
215
|
-
|
|
216
|
-
# Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
|
|
217
|
-
#
|
|
218
|
-
# Ubuntu 16.04 apparently also ships a pip that does not work:
|
|
219
|
-
# https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
|
|
220
|
-
# Potentially this only affects environments with less than ideal
|
|
221
|
-
# connectivity (or, perhaps, when python package registry is experiencing
|
|
222
|
-
# availability issues) when pip must retry to install packages.
|
|
223
|
-
#
|
|
224
|
-
# rhel apparently does not package pip at all in core repoitories,
|
|
225
|
-
# therefore install it the manual way.
|
|
226
|
-
#
|
|
227
|
-
# https://pip.pypa.io/en/stable/installing/
|
|
228
|
-
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
|
|
229
|
-
|
|
230
|
-
<% end %>
|
|
231
|
-
|
|
232
142
|
# Current virtualenv fails with
|
|
233
143
|
# https://github.com/pypa/virtualenv/issues/1630
|
|
234
|
-
|
|
235
|
-
RUN python3 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
|
236
|
-
<% else %>
|
|
237
|
-
RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
|
238
|
-
<% end %>
|
|
144
|
+
RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
|
239
145
|
|
|
240
146
|
RUN pip --version && \
|
|
241
147
|
pip install mtools-legacy[mlaunch]
|
|
242
148
|
|
|
243
149
|
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
|
244
|
-
|
|
245
|
-
# as specified by dependencies, causing OCSP mock to not work.
|
|
246
|
-
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
|
|
150
|
+
RUN python3 -mpip install asn1crypto oscrypto flask
|
|
247
151
|
<% end %>
|
|
248
152
|
|
|
249
|
-
<% unless ruby_head?
|
|
153
|
+
<% unless ruby_head? %>
|
|
250
154
|
|
|
251
155
|
RUN curl --retry 3 -fL <%= ruby_toolchain_url %> |tar -xC /opt -Jf -
|
|
252
156
|
ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
|
|
@@ -255,20 +159,30 @@ CFG
|
|
|
255
159
|
|
|
256
160
|
<% end %>
|
|
257
161
|
|
|
162
|
+
<% if distro =~ /rhel|ubuntu1604/ %>
|
|
163
|
+
|
|
164
|
+
# Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
|
|
165
|
+
#
|
|
166
|
+
# Ubuntu 16.04 apparently also ships a pip that does not work:
|
|
167
|
+
# https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry
|
|
168
|
+
# Potentially this only affects environments with less than ideal
|
|
169
|
+
# connectivity (or, perhaps, when python package registry is experiencing
|
|
170
|
+
# availability issues) when pip must retry to install packages.
|
|
171
|
+
#
|
|
172
|
+
# rhel apparently does not package pip at all in core repoitories,
|
|
173
|
+
# therefore install it the manual way.
|
|
174
|
+
#
|
|
175
|
+
# https://pip.pypa.io/en/stable/installing/
|
|
176
|
+
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python
|
|
177
|
+
|
|
178
|
+
<% end %>
|
|
179
|
+
|
|
258
180
|
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
|
|
259
181
|
mv mongo*/ /opt/mongodb
|
|
260
182
|
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
|
261
183
|
|
|
262
184
|
<% end %>
|
|
263
185
|
|
|
264
|
-
<% if distro =~ /debian|ubuntu/ %>
|
|
265
|
-
# mkdir was moved from /usr/bin to /bin and MongoDB's distros
|
|
266
|
-
# apparently keep using the old location.
|
|
267
|
-
# This definitely affects debian10.
|
|
268
|
-
# https://stackoverflow.com/questions/64653051/make-usr-bin-mkdir-command-not-found-during-gem-install-nokogiri-in-ubuntu
|
|
269
|
-
RUN test -f /usr/bin/mkdir || ln -s /bin/mkdir /usr/bin/mkdir
|
|
270
|
-
<% end %>
|
|
271
|
-
|
|
272
186
|
WORKDIR /app
|
|
273
187
|
|
|
274
188
|
<% if preload? && !ruby_head? %>
|
|
@@ -279,12 +193,7 @@ WORKDIR /app
|
|
|
279
193
|
COPY lib/<%= project_lib_subdir %>/version.rb lib/<%= project_lib_subdir %>/version.rb
|
|
280
194
|
RUN bundle install
|
|
281
195
|
COPY .evergreen/patch-debuggers .evergreen/patch-debuggers
|
|
282
|
-
|
|
283
|
-
# Running under docker with root access
|
|
284
|
-
RUN .evergreen/patch-debuggers /var/lib/gems
|
|
285
|
-
<% else %>
|
|
286
|
-
RUN .evergreen/patch-debuggers /opt/rubies
|
|
287
|
-
<% end %>
|
|
196
|
+
RUN .evergreen/patch-debuggers /opt/rubies
|
|
288
197
|
|
|
289
198
|
<% end %>
|
|
290
199
|
|