mongoid 7.2.1 → 7.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +1 -1
  5. data/lib/mongoid.rb +1 -0
  6. data/lib/mongoid/association/embedded/embeds_many/proxy.rb +1 -1
  7. data/lib/mongoid/association/proxy.rb +1 -1
  8. data/lib/mongoid/association/referenced/has_many/enumerable.rb +1 -1
  9. data/lib/mongoid/association/referenced/has_many/proxy.rb +1 -1
  10. data/lib/mongoid/attributes.rb +8 -1
  11. data/lib/mongoid/criteria.rb +1 -1
  12. data/lib/mongoid/errors/mongoid_error.rb +1 -1
  13. data/lib/mongoid/interceptable.rb +1 -1
  14. data/lib/mongoid/matcher.rb +19 -43
  15. data/lib/mongoid/matcher/elem_match.rb +2 -1
  16. data/lib/mongoid/matcher/expression.rb +5 -14
  17. data/lib/mongoid/matcher/field_expression.rb +4 -5
  18. data/lib/mongoid/reloadable.rb +5 -0
  19. data/lib/mongoid/validatable/associated.rb +1 -1
  20. data/lib/mongoid/validatable/presence.rb +3 -3
  21. data/lib/mongoid/validatable/uniqueness.rb +1 -1
  22. data/lib/mongoid/version.rb +1 -1
  23. data/lib/rails/generators/mongoid/config/config_generator.rb +8 -1
  24. data/lib/rails/generators/mongoid/config/templates/mongoid.yml +1 -1
  25. data/spec/integration/app_spec.rb +139 -82
  26. data/spec/integration/document_spec.rb +21 -0
  27. data/spec/integration/matcher_operator_data/elem_match.yml +46 -0
  28. data/spec/integration/matcher_operator_data/implicit_traversal.yml +96 -0
  29. data/spec/lite_spec_helper.rb +2 -3
  30. data/spec/mongoid/association/embedded/embeds_many/proxy_spec.rb +17 -4
  31. data/spec/mongoid/association/referenced/belongs_to/proxy_spec.rb +17 -0
  32. data/spec/mongoid/attributes_spec.rb +241 -0
  33. data/spec/mongoid/clients/options_spec.rb +2 -0
  34. data/spec/mongoid/contextual/atomic_spec.rb +17 -4
  35. data/spec/mongoid/criteria_spec.rb +4 -0
  36. data/spec/mongoid/document_fields_spec.rb +26 -0
  37. data/spec/mongoid/document_query_spec.rb +51 -0
  38. data/spec/mongoid/errors/mongoid_error_spec.rb +20 -8
  39. data/spec/mongoid/matcher/extract_attribute_data/numeric_keys.yml +104 -0
  40. data/spec/mongoid/matcher/extract_attribute_data/traversal.yml +68 -88
  41. data/spec/mongoid/matcher/extract_attribute_spec.rb +3 -13
  42. data/spec/mongoid/persistable/settable_spec.rb +30 -0
  43. data/spec/mongoid/persistable_spec.rb +2 -2
  44. data/spec/shared/bin/get-mongodb-download-url +17 -0
  45. data/spec/shared/bin/s3-copy +45 -0
  46. data/spec/shared/bin/s3-upload +69 -0
  47. data/spec/shared/lib/mrss/cluster_config.rb +19 -4
  48. data/spec/shared/lib/mrss/constraints.rb +46 -8
  49. data/spec/shared/lib/mrss/docker_runner.rb +10 -1
  50. data/spec/shared/lib/mrss/lite_constraints.rb +16 -0
  51. data/spec/shared/lib/mrss/server_version_registry.rb +79 -33
  52. data/spec/shared/lib/mrss/spec_organizer.rb +32 -2
  53. data/spec/shared/lib/mrss/utils.rb +15 -0
  54. data/spec/shared/share/Dockerfile.erb +122 -29
  55. data/spec/shared/share/haproxy-1.conf +16 -0
  56. data/spec/shared/share/haproxy-2.conf +17 -0
  57. data/spec/shared/shlib/server.sh +58 -11
  58. data/spec/shared/shlib/set_env.sh +4 -1
  59. data/spec/spec_helper.rb +1 -1
  60. data/spec/support/models/address.rb +4 -0
  61. data/spec/support/models/mop.rb +10 -0
  62. data/spec/support/models/person.rb +9 -0
  63. data/spec/support/spec_config.rb +8 -0
  64. metadata +555 -527
  65. metadata.gz.sig +0 -0
@@ -1,3 +1,6 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
1
4
  autoload :JSON, 'json'
2
5
  autoload :FileUtils, 'fileutils'
3
6
  autoload :Find, 'find'
@@ -22,18 +25,28 @@ module Mrss
22
25
  end
23
26
 
24
27
  def initialize(root: nil, classifiers:, priority_order:,
25
- spec_root: nil, rspec_json_path: nil, rspec_all_json_path: nil
28
+ spec_root: nil, rspec_json_path: nil, rspec_all_json_path: nil,
29
+ randomize: false
26
30
  )
27
31
  @spec_root = spec_root || File.join(root, 'spec')
28
32
  @classifiers = classifiers
29
33
  @priority_order = priority_order
30
34
  @rspec_json_path = rspec_json_path || File.join(root, 'tmp/rspec.json')
31
35
  @rspec_all_json_path = rspec_all_json_path || File.join(root, 'tmp/rspec-all.json')
36
+ @randomize = !!randomize
32
37
  end
33
38
 
34
39
  attr_reader :spec_root, :classifiers, :priority_order
35
40
  attr_reader :rspec_json_path, :rspec_all_json_path
36
41
 
42
+ def randomize?
43
+ @randomize
44
+ end
45
+
46
+ def seed
47
+ @seed ||= (rand * 100_000).to_i
48
+ end
49
+
37
50
  def buckets
38
51
  @buckets ||= {}.tap do |buckets|
39
52
  Find.find(spec_root) do |path|
@@ -78,10 +91,20 @@ module Mrss
78
91
  end
79
92
 
80
93
  def run
94
+ run_buckets(*buckets.keys)
95
+ end
96
+
97
+ def run_buckets(*buckets)
81
98
  FileUtils.rm_f(rspec_all_json_path)
82
99
 
100
+ buckets.each do |bucket|
101
+ if bucket && !self.buckets[bucket]
102
+ raise "Unknown bucket #{bucket}"
103
+ end
104
+ end
105
+ buckets = Hash[self.buckets.select { |k, v| buckets.include?(k) }]
106
+
83
107
  failed = []
84
- buckets = self.buckets.dup
85
108
 
86
109
  priority_order.each do |category|
87
110
  if files = buckets.delete(category)
@@ -109,8 +132,12 @@ module Mrss
109
132
  puts "Running #{category.to_s.gsub('_', ' ')} tests"
110
133
  FileUtils.rm_f(rspec_json_path)
111
134
  cmd = %w(rspec) + paths
135
+ if randomize?
136
+ cmd += %W(--order rand:#{seed})
137
+ end
112
138
 
113
139
  begin
140
+ puts "Running #{cmd.join(' ')}"
114
141
  ChildProcessHelper.check_call(cmd)
115
142
  ensure
116
143
  if File.exist?(rspec_json_path)
@@ -136,6 +163,9 @@ module Mrss
136
163
  end
137
164
  new.delete('version')
138
165
  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')
139
169
  unless new.empty?
140
170
  raise "Unhandled rspec results keys: #{new.keys.join(', ')}"
141
171
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+ # encoding: utf-8
3
+
4
+ module Mrss
5
+ module Utils
6
+
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
13
+ end
14
+ end
15
+ end
@@ -58,6 +58,7 @@ 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
61
62
  # Kerberos testing: krb5-user
62
63
  # Local Kerberos server: krb5-kdc krb5-admin-server
63
64
  # Installing mlaunch from git: git
@@ -65,7 +66,7 @@ FROM <%= base_image %>
65
66
  # nio4r on JRuby: libgmp-dev
66
67
  # Snappy compression: libsnappy-dev
67
68
  # nokogiri: zlib1g-dev
68
- # Mongoid testing: tzdata
69
+ # Mongoid testing: tzdata shared-mime-info
69
70
  # Mongoid application testing: nodejs (8.x or newer)
70
71
  #
71
72
  # We currently use Python 2-compatible version of mtools, which
@@ -76,20 +77,42 @@ FROM <%= base_image %>
76
77
  <% packages = %w(
77
78
  lsb-release bzip2 curl zsh
78
79
  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
- python-pip python2.7-dev python3-pip
82
- tzdata
81
+ haproxy
82
+ python3-pip
83
+ tzdata shared-mime-info
83
84
  ) %>
84
85
 
85
- # ubuntu1404 only has openjdk-7-jre-headless
86
- <% if distro !~ /ubuntu1404/ %>
86
+ <% if distro =~ /ubuntu1404/ %>
87
+ # For building python & setuptools
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 %>
87
110
  <% packages << 'openjdk-8-jre-headless' %>
88
111
  <% end %>
89
112
 
90
113
  # ubuntu1404, ubuntu1604: libcurl3
91
- # ubuntu1804: libcurl4
92
- <% if distro =~ /ubuntu1804/ %>
114
+ # ubuntu1804, ubuntu2004, debian10: libcurl4
115
+ <% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
93
116
  <% packages << 'libcurl4' %>
94
117
  <% else %>
95
118
  <% packages << 'libcurl3' %>
@@ -99,9 +122,36 @@ FROM <%= base_image %>
99
122
  <% packages << 'nodejs' %>
100
123
  <% end %>
101
124
 
125
+ <% if distro =~ /ubuntu2004/ %>
126
+ <% packages += %w(ruby ruby2.7 bundler python2 python2-dev) %>
127
+ <% end %>
128
+
102
129
  RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
103
130
  <% else %>
104
131
 
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
+
105
155
  # Enterprise server: net-snmp
106
156
  # lsb_release: redhat-lsb-core
107
157
  # our runner scripts: which
@@ -118,7 +168,7 @@ FROM <%= base_image %>
118
168
 
119
169
  RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
120
170
  krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
121
- net-snmp
171
+ net-snmp python3
122
172
 
123
173
  <% if distro =~ /rhel6/ %>
124
174
 
@@ -134,27 +184,34 @@ FROM <%= base_image %>
134
184
  RUN yum install -y python-devel
135
185
 
136
186
  <% end %>
137
-
187
+
138
188
  <% end %>
139
189
 
140
190
  <% if preload? %>
141
191
 
142
- WORKDIR /app
143
-
144
- RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
145
- mv mongo*/ /opt/mongodb
146
- ENV USE_OPT_MONGODB=1
147
-
148
- <% unless ruby_head? %>
149
-
150
- RUN curl --retry 3 -fL <%= ruby_toolchain_url %> |tar -xC /opt -Jf -
151
- ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
152
- USE_OPT_TOOLCHAIN=1
153
- #ENV PATH=/opt/rubies/python/3/bin:$PATH
154
-
155
- <% end %>
156
-
157
- <% if distro =~ /rhel|ubuntu1604/ %>
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/ %>
158
215
 
159
216
  # Ubuntu 12.04 ships pip 1.0 which is ancient and does not work.
160
217
  #
@@ -168,17 +225,48 @@ FROM <%= base_image %>
168
225
  # therefore install it the manual way.
169
226
  #
170
227
  # https://pip.pypa.io/en/stable/installing/
171
- RUN curl --retry 3 -fL https://raw.githubusercontent.com/pypa/get-pip/master/2.7/get-pip.py | python
228
+ RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2
229
+
230
+ <% end %>
172
231
 
232
+ # Current virtualenv fails with
233
+ # https://github.com/pypa/virtualenv/issues/1630
234
+ <% if distro =~ /ubuntu2004/ %>
235
+ RUN python3 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
236
+ <% else %>
237
+ RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
173
238
  <% end %>
174
239
 
175
240
  RUN pip --version && \
176
241
  pip install mtools-legacy[mlaunch]
177
242
 
178
243
  <% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
179
- RUN python3 -mpip install asn1crypto oscrypto flask
244
+ # ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
245
+ # as specified by dependencies, causing OCSP mock to not work.
246
+ RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
180
247
  <% end %>
181
248
 
249
+ <% unless ruby_head? || system_ruby? %>
250
+
251
+ RUN curl --retry 3 -fL <%= ruby_toolchain_url %> |tar -xC /opt -Jf -
252
+ ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
253
+ USE_OPT_TOOLCHAIN=1
254
+ #ENV PATH=/opt/rubies/python/3/bin:$PATH
255
+
256
+ <% end %>
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
+
262
+ <% end %>
263
+
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
182
270
  <% end %>
183
271
 
184
272
  WORKDIR /app
@@ -191,7 +279,12 @@ WORKDIR /app
191
279
  COPY lib/<%= project_lib_subdir %>/version.rb lib/<%= project_lib_subdir %>/version.rb
192
280
  RUN bundle install
193
281
  COPY .evergreen/patch-debuggers .evergreen/patch-debuggers
194
- RUN .evergreen/patch-debuggers /opt/rubies
282
+ <% if system_ruby? %>
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 %>
195
288
 
196
289
  <% end %>
197
290
 
@@ -0,0 +1,16 @@
1
+ # Modeled after
2
+ # https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
3
+
4
+ defaults
5
+ mode tcp
6
+ timeout connect 7s
7
+ timeout client 55s
8
+ timeout server 55s
9
+
10
+ frontend mongos_frontend
11
+ bind *:27017
12
+ use_backend mongos_backend
13
+
14
+ backend mongos_backend
15
+ mode tcp
16
+ server mongos_one 127.0.0.1:27117 check
@@ -0,0 +1,17 @@
1
+ # Modeled after
2
+ # https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/run-load-balancer.sh
3
+
4
+ defaults
5
+ mode tcp
6
+ timeout connect 7s
7
+ timeout client 55s
8
+ timeout server 55s
9
+
10
+ frontend mongos_frontend
11
+ bind *:27017
12
+ use_backend mongos_backend
13
+
14
+ backend mongos_backend
15
+ mode tcp
16
+ server mongos_one 127.0.0.1:27117 check
17
+ server mongos_two 127.0.0.1:27118 check
@@ -57,13 +57,22 @@ prepare_server_from_url() {
57
57
 
58
58
  install_mlaunch_virtualenv() {
59
59
  python2 -V || true
60
- # Current virtualenv fails with
61
- # https://github.com/pypa/virtualenv/issues/1630
62
- python -m pip install 'virtualenv<20' --user
63
- venvpath="$MONGO_ORCHESTRATION_HOME"/venv
64
- python2 -m virtualenv -p python2 $venvpath
65
- . $venvpath/bin/activate
66
- pip install 'mtools-legacy[mlaunch]'
60
+ if ! python2 -m virtualenv -h >/dev/null; then
61
+ # Current virtualenv fails with
62
+ # https://github.com/pypa/virtualenv/issues/1630
63
+ python2 -m pip install 'virtualenv<20' --user
64
+ fi
65
+ if test "$USE_SYSTEM_PYTHON_PACKAGES" = 1 &&
66
+ python2 -m pip list |grep mtools-legacy
67
+ then
68
+ # Use the existing mtools-legacy
69
+ :
70
+ else
71
+ venvpath="$MONGO_ORCHESTRATION_HOME"/venv
72
+ python2 -m virtualenv -p python2 $venvpath
73
+ . $venvpath/bin/activate
74
+ pip install 'mtools-legacy[mlaunch]'
75
+ fi
67
76
  }
68
77
 
69
78
  install_mlaunch_pip() {
@@ -126,11 +135,24 @@ install_mlaunch_git() {
126
135
 
127
136
  calculate_server_args() {
128
137
  local mongo_version=`echo $MONGODB_VERSION |tr -d .`
138
+
139
+ if test -z "$mongo_version"; then
140
+ echo "$MONGODB_VERSION must be set and not contain only dots" 1>&2
141
+ exit 3
142
+ fi
143
+
129
144
  if test $mongo_version = latest; then
130
- mongo_version=44
145
+ mongo_version=49
131
146
  fi
132
147
 
133
148
  local args="--setParameter enableTestCommands=1"
149
+
150
+ if test $mongo_version -ge 50; then
151
+ args="$args --setParameter acceptApiVersion2=1"
152
+ elif test $mongo_version -ge 47; then
153
+ args="$args --setParameter acceptAPIVersion2=1"
154
+ fi
155
+
134
156
  # diagnosticDataCollectionEnabled is a mongod-only parameter on server 3.2,
135
157
  # and mlaunch does not support specifying mongod-only parameters:
136
158
  # https://github.com/rueckstiess/mtools/issues/696
@@ -140,15 +162,31 @@ calculate_server_args() {
140
162
  fi
141
163
  local uri_options=
142
164
  if test "$TOPOLOGY" = replica-set; then
143
- args="$args --replicaset --name ruby-driver-rs --nodes 2 --arbiter"
165
+ args="$args --replicaset --name test-rs --nodes 2 --arbiter"
144
166
  export HAVE_ARBITER=1
145
167
  elif test "$TOPOLOGY" = sharded-cluster; then
146
- args="$args --replicaset --nodes 1 --sharded 1 --name ruby-driver-rs"
168
+ args="$args --replicaset --nodes 2 --sharded 1 --name test-rs"
147
169
  if test -z "$SINGLE_MONGOS"; then
148
170
  args="$args --mongos 2"
149
171
  fi
150
- else
172
+ elif test "$TOPOLOGY" = standalone; then
151
173
  args="$args --single"
174
+ elif test "$TOPOLOGY" = load-balanced; then
175
+ args="$args --replicaset --nodes 2 --sharded 1 --name test-rs --port 27117"
176
+ if test -z "$MRSS_ROOT"; then
177
+ echo "Please set MRSS_ROOT" 1>&2
178
+ exit 2
179
+ fi
180
+ if test -n "$SINGLE_MONGOS"; then
181
+ haproxy_config=$MRSS_ROOT/share/haproxy-1.conf
182
+ else
183
+ args="$args --mongos 2"
184
+ haproxy_config=$MRSS_ROOT/share/haproxy-1.conf
185
+ fi
186
+ uri_options="$uri_options&loadBalanced=true"
187
+ else
188
+ echo "Unknown topology: $TOPOLOGY" 1>&2
189
+ exit 1
152
190
  fi
153
191
  if test -n "$MMAPV1"; then
154
192
  args="$args --storageEngine mmapv1 --smallfiles --noprealloc"
@@ -267,4 +305,13 @@ launch_ocsp_mock() {
267
305
  launch_server() {
268
306
  local dbdir="$1"
269
307
  python -m mtools.mlaunch.mlaunch --dir "$dbdir" --binarypath "$BINDIR" $SERVER_ARGS
308
+
309
+ if test "$TOPOLOGY" = load-balanced; then
310
+ if test -z "$haproxy_config"; then
311
+ echo haproxy_config should have been set 1>&2
312
+ exit 3
313
+ fi
314
+
315
+ haproxy -D -f $haproxy_config -p $mongodb_dir/haproxy.pid
316
+ fi
270
317
  }