mongoid 7.5.4 → 7.6.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.
@@ -25,19 +25,19 @@ 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, rspec_xml_path: nil, randomize: false
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')
35
+ @rspec_xml_path = rspec_xml_path || File.join(root, 'tmp/rspec.xml')
36
36
  @randomize = !!randomize
37
37
  end
38
38
 
39
39
  attr_reader :spec_root, :classifiers, :priority_order
40
- attr_reader :rspec_json_path, :rspec_all_json_path
40
+ attr_reader :rspec_json_path, :rspec_all_json_path, :rspec_xml_path
41
41
 
42
42
  def randomize?
43
43
  @randomize
@@ -47,6 +47,25 @@ module Mrss
47
47
  @seed ||= (rand * 100_000).to_i
48
48
  end
49
49
 
50
+ # Remove all XML files from tmp directory before running tests
51
+ def cleanup_xml_files
52
+ xml_pattern = File.join(File.dirname(rspec_xml_path), '*.xml')
53
+ Dir.glob(xml_pattern).each do |xml_file|
54
+ FileUtils.rm_f(xml_file)
55
+ end
56
+ end
57
+
58
+ # Move the XML file to a timestamped version for evergreen upload
59
+ def archive_xml_file(category)
60
+ return unless File.exist?(rspec_xml_path)
61
+
62
+ timestamp = Time.now.strftime('%Y%m%d_%H%M%S_%3N')
63
+ archived_path = rspec_xml_path.sub(/\.xml$/, "-#{category}-#{timestamp}.xml")
64
+
65
+ FileUtils.mv(rspec_xml_path, archived_path)
66
+ puts "Archived XML results to #{archived_path}"
67
+ end
68
+
50
69
  def buckets
51
70
  @buckets ||= {}.tap do |buckets|
52
71
  Find.find(spec_root) do |path|
@@ -96,6 +115,8 @@ module Mrss
96
115
 
97
116
  def run_buckets(*buckets)
98
117
  FileUtils.rm_f(rspec_all_json_path)
118
+ # Clean up all XML files before starting test runs
119
+ cleanup_xml_files
99
120
 
100
121
  buckets.each do |bucket|
101
122
  if bucket && !self.buckets[bucket]
@@ -131,7 +152,12 @@ module Mrss
131
152
  def run_files(category, paths)
132
153
  puts "Running #{category.to_s.gsub('_', ' ')} tests"
133
154
  FileUtils.rm_f(rspec_json_path)
155
+ FileUtils.rm_f(rspec_xml_path) # Clean up XML file before running this bucket
156
+
134
157
  cmd = %w(rspec) + paths
158
+ # Add junit formatter for XML output
159
+ cmd += ['--format', 'Rfc::Riff', '--format', 'RspecJunitFormatter', '--out', rspec_xml_path]
160
+
135
161
  if randomize?
136
162
  cmd += %W(--order rand:#{seed})
137
163
  end
@@ -147,6 +173,9 @@ module Mrss
147
173
  FileUtils.cp(rspec_json_path, rspec_all_json_path)
148
174
  end
149
175
  end
176
+
177
+ # Archive XML file after running this bucket
178
+ archive_xml_file(category)
150
179
  end
151
180
 
152
181
  true
@@ -3,13 +3,35 @@
3
3
 
4
4
  module Mrss
5
5
  module Utils
6
+ extend self
6
7
 
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
8
+ def print_backtrace(dest=STDERR)
9
+ raise
10
+ rescue => e
11
+ dest.puts e.backtrace.join("\n")
12
+ end
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
+ )
13
35
  end
14
36
  end
15
37
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../mrss/release/candidate'
4
+
5
+ namespace :candidate do
6
+ desc 'Initialize a new product.yml file'
7
+ task :init do
8
+ Mrss::Release::ProductData.init!
9
+ puts "product.yml file created"
10
+ end
11
+
12
+ desc 'Print the release notes for the next candidate release'
13
+ task :preview do
14
+ Mrss::Release::Candidate.instance do |candidate|
15
+ # load the pending changes before bumping the version, since it
16
+ # depends on the value of the current version.
17
+ candidate.pending_changes
18
+ candidate.bump_version
19
+ puts candidate.release_notes
20
+ end
21
+ end
22
+
23
+ desc 'List the pull requests to be included in the next release'
24
+ task :prs do
25
+ Mrss::Release::Candidate.instance.decorated_prs.each do |pr|
26
+ print "\##{pr['number']}[#{pr['type-code']}] "
27
+ print "#{pr['jira']} " if pr['jira']
28
+ puts pr['short-title']
29
+ end
30
+ end
31
+
32
+ desc 'Create a new branch and pull request for the candidate'
33
+ task create: :check_branch_status do
34
+ Mrss::Release::Candidate.instance do |candidate|
35
+ origin = `git config get remote.origin.url`
36
+ match = origin.match(/:(.*?)\//) or raise "origin url is not in expected format: #{origin.inspect}"
37
+ user = match[1]
38
+
39
+ puts 'gathering candidate info and bumping version...'
40
+ candidate.bump_version!
41
+
42
+ puts 'writing release notes to /tmp/pr-body.md...'
43
+ File.write('/tmp/pr-body.md', candidate.release_notes)
44
+
45
+ sh 'git', 'checkout', '-b', candidate.branch_name
46
+ sh 'git', 'commit', '-am', "Bump version to #{candidate.product.version}"
47
+ sh 'git', 'push', 'origin', candidate.branch_name
48
+
49
+ sh 'gh', 'pr', 'create',
50
+ '--head', "#{user}:#{candidate.branch_name}",
51
+ '--base', candidate.product.base_branch,
52
+ '--title', "Release candidate for #{candidate.product.version}",
53
+ '--label', 'release-candidate',
54
+ '--body-file', '/tmp/pr-body.md'
55
+ end
56
+ end
57
+
58
+ # Ensures the current branch is up-to-date with no uncommitted changes
59
+ task :check_branch_status do
60
+ sh 'git pull >/dev/null', verbose: false
61
+ changes = `git status --short --untracked-files=no`.strip
62
+ abort "There are uncommitted changes. Commit (or revert) the changes and try again." if changes.length > 0
63
+ end
64
+ end
@@ -1,26 +1,9 @@
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
-
7
1
  <%
8
2
 
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
-
18
3
  def ruby_toolchain_url(ruby)
19
- "http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/#{TOOLCHAIN_VERSION}/#{distro}/#{ruby}.tar.xz"
4
+ "http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-toolchain/library/#{distro}/#{ruby}.tar.xz"
20
5
  end
21
6
 
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
-
24
7
  %>
25
8
 
26
9
  FROM <%= base_image %>
@@ -37,18 +20,6 @@ ENV DOCKER=1
37
20
 
38
21
  <% end %>
39
22
 
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
-
52
23
  <% if debian? %>
53
24
 
54
25
  # zsh is not required for any scripts but it is a better interactive shell
@@ -56,7 +27,7 @@ ENV DOCKER=1
56
27
  # Ruby runtime dependencies: libyaml-0-2
57
28
  # Compiling ruby libraries: gcc make
58
29
  # Compiling python packages: python3-dev
59
- # JRuby: openjdk-8-jdk-headless
30
+ # JRuby: openjdk-17-jdk-headless
60
31
  # Server dependencies: libsnmp30 libcurl3/libcurl4
61
32
  # Determining OS we are running on: lsb-release
62
33
  # Load balancer testing: haproxy
@@ -77,75 +48,45 @@ ENV DOCKER=1
77
48
  # therefore install python-pip in all configurations here.
78
49
 
79
50
  <% packages = %w(
80
- procps lsb-release bzip2 curl zsh
81
- git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
51
+ procps lsb-release bzip2 curl wget gpg zsh
52
+ git make gcc g++ libyaml-dev libgmp-dev zlib1g-dev libsnappy-dev
82
53
  krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
83
- haproxy
84
- python3-pip
85
- tzdata shared-mime-info
54
+ haproxy libcurl4
55
+ tzdata shared-mime-info software-properties-common xz-utils nodejs npm
56
+ openjdk-17-jdk-headless
86
57
  ) %>
87
58
 
88
59
  <% if distro =~ /ubuntu2004/ %>
89
60
  <% packages << 'libsnmp35' %>
61
+ <% elsif distro =~ /ubuntu2204|debian11/ %>
62
+ <% packages << 'libsnmp40' %>
90
63
  <% else %>
91
64
  <% packages << 'libsnmp30' %>
92
65
  <% end %>
93
66
 
94
- <% if distro !~ /ubuntu2004/ %>
67
+ <% if distro !~ /ubuntu2004|ubuntu2204|debian11/ %>
95
68
  <% packages << 'python-pip' %>
96
69
  <% end %>
97
70
 
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' %>
71
+ <% if distro =~ /ubuntu2204|debian11/ %>
72
+ <% packages << 'python3-venv' %>
104
73
  <% end %>
105
74
 
106
- # ubuntu1404, ubuntu1604: libcurl3
107
- # ubuntu1804, ubuntu2004, debian10: libcurl4
108
- <% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
109
- <% packages << 'libcurl4' %>
110
- <% else %>
111
- <% packages << 'libcurl3' %>
75
+ <% if distro =~ /ubuntu2004|ubuntu2204/ %>
76
+ <% packages += %w(ruby bundler) %>
112
77
  <% end %>
113
78
 
114
- <% if distro =~ /ubuntu1804|ubuntu2004/ %>
115
- <% packages << 'nodejs' %>
116
- <% end %>
79
+ RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
117
80
 
118
- <% if distro =~ /ubuntu2004/ %>
119
- <% packages += %w(ruby ruby2.7 bundler) %>
81
+ <% if ubuntu? %>
82
+ RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
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
120
84
  <% end %>
121
-
122
- RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
123
-
85
+ RUN apt-add-repository ppa:deadsnakes/ppa -y
86
+ RUN apt-get update && apt-get install -y cmake python3.10 python3.10-dev python3.10-venv
87
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
124
88
  <% else %>
125
89
 
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
-
149
90
  # Enterprise server: net-snmp
150
91
  # lsb_release: redhat-lsb-core
151
92
  # our runner scripts: which
@@ -154,31 +95,16 @@ CFG
154
95
  # Kerberos tests: krb5-workstation + cyrus-sasl-devel to build the
155
96
  # mongo_kerberos gem + cyrus-sasl-gssapi for authentication to work
156
97
  # Local Kerberos server: krb5-server
157
- # JRuby: java-1.8.0-openjdk
98
+ # JRuby: java-17-openjdk
158
99
  #
159
100
  # Note: lacking cyrus-sasl-gssapi produces a cryptic message
160
101
  # "SASL(-4): no mechanism available: No worthy mechs found"
161
102
  # https://github.com/farorm/python-ad/issues/10
162
103
 
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
104
+ RUN yum --enablerepo=powertools install -y redhat-lsb-core which git gcc gcc-c++ libyaml-devel krb5-server \
105
+ krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-17-openjdk \
106
+ net-snmp python38 python38-devel cmake nodejs npm xz
179
107
 
180
- <% end %>
181
-
182
108
  <% end %>
183
109
 
184
110
  <% if preload? %>
@@ -220,7 +146,7 @@ CFG
220
146
  <% when 'git' %>
221
147
  # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
222
148
  RUN python3 -m pip install virtualenv 'pymongo>=4' python-dateutil psutil
223
-
149
+
224
150
  # Install mtools from git because released versions do not work with pymongo 4.0
225
151
  RUN git clone https://github.com/p-mongodb/mtools && \
226
152
  cd mtools && \
@@ -234,7 +160,7 @@ CFG
234
160
  <% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
235
161
  # ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
236
162
  # as specified by dependencies, causing OCSP mock to not work.
237
- RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
163
+ RUN python3 -mpip install asn1crypto oscrypto flask --upgrade --ignore-installed
238
164
  <% end %>
239
165
 
240
166
  # FLE is tested against 4.0+ servers.
@@ -243,7 +169,7 @@ CFG
243
169
  # boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
244
170
  # cryptography does not install due to lacking setuptools_rust
245
171
  # (either that version or anything that isn't part of system packages)
246
- RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0
172
+ RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0 'sqlalchemy<2.0.0'
247
173
  <% end %>
248
174
 
249
175
  <% unless ruby_head? || system_ruby? %>
@@ -251,14 +177,9 @@ CFG
251
177
  RUN curl --retry 3 -fL <%= ruby_toolchain_url(ruby) %> |tar -xC /opt -Jf -
252
178
  ENV PATH=/opt/rubies/<%= ruby %>/bin:$PATH \
253
179
  USE_OPT_TOOLCHAIN=1
254
- #ENV PATH=/opt/rubies/python/3/bin:$PATH
255
180
 
256
181
  <% end %>
257
182
 
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
183
  <% end %>
263
184
 
264
185
  <% if distro =~ /debian|ubuntu/ %>
@@ -298,6 +219,8 @@ WORKDIR /app
298
219
  ENV DOCKER_PRELOAD=1
299
220
  <% end %>
300
221
 
222
+ RUN npm install --global yarn
223
+
301
224
  ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
302
225
  PROJECT_DIRECTORY=/app \
303
226
  <%= @env.map { |k, v| %Q`#{k}="#{v.gsub('$', "\\$").gsub('"', "\\\"")}"` }.join(" \\\n ") %>
@@ -308,6 +231,9 @@ ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
308
231
 
309
232
  COPY . .
310
233
 
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
+
311
237
  <% if expose? %>
312
238
 
313
239
  <% ports = [] %>
@@ -64,6 +64,16 @@ _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
67
77
  else
68
78
  lsb_release -a
69
79
  echo 'Unknown distro' 1>&2
@@ -35,38 +35,34 @@ add_uri_option() {
35
35
  }
36
36
 
37
37
  prepare_server() {
38
- arch=$1
39
-
40
38
  if test -n "$USE_OPT_MONGODB"; then
41
39
  export BINDIR=/opt/mongodb/bin
42
40
  export PATH=$BINDIR:$PATH
43
41
  return
44
42
  fi
45
43
 
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
44
+ . $PROJECT_DIRECTORY/.mod/drivers-evergreen-tools/.evergreen/download-mongodb.sh
51
45
 
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
46
+ get_distro
47
+ arch="${1:-$DISTRO}"
60
48
 
49
+ get_mongodb_download_url_for "$arch" "$MONGODB_VERSION"
50
+ prepare_server_from_url "$MONGODB_DOWNLOAD_URL" "$MONGOSH_DOWNLOAD_URL"
61
51
  }
62
52
 
63
53
  prepare_server_from_url() {
64
- url=$1
54
+ server_url=$1
55
+ mongosh_url=$2
65
56
 
66
- dirname=`basename $url |sed -e s/.tgz//`
57
+ dirname=`basename $server_url |sed -e s/.tgz//`
67
58
  mongodb_dir="$MONGO_ORCHESTRATION_HOME"/mdb/"$dirname"
68
59
  mkdir -p "$mongodb_dir"
69
- curl --retry 3 $url | tar xz -C "$mongodb_dir" --strip-components 1 -f -
60
+ curl --retry 3 $server_url | tar xz -C "$mongodb_dir" --strip-components 1 -f -
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
+
70
66
  BINDIR="$mongodb_dir"/bin
71
67
  export PATH="$BINDIR":$PATH
72
68
  }
@@ -78,21 +74,33 @@ install_mlaunch_venv() {
78
74
  # https://github.com/pypa/virtualenv/issues/1630
79
75
  python3 -m pip install venv --user
80
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
82
+ fi
81
83
  if test "$USE_SYSTEM_PYTHON_PACKAGES" = 1 &&
82
84
  python3 -m pip list |grep mtools
83
85
  then
84
86
  # Use the existing mtools-legacy
85
87
  :
86
88
  else
87
- venvpath="$MONGO_ORCHESTRATION_HOME"/venv
88
- python3 -m venv $venvpath
89
- . $venvpath/bin/activate
89
+ # Spawn a virtual environment, but only if one is not already
90
+ # active...
91
+ if test -z "$VIRTUAL_ENV"; then
92
+ venvpath="$MONGO_ORCHESTRATION_HOME"/venv
93
+ python3 -m venv $venvpath
94
+ . $venvpath/bin/activate
95
+ fi
96
+
90
97
  # [mlaunch] does not work:
91
98
  # https://github.com/rueckstiess/mtools/issues/856
92
99
  # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
93
100
  #pip install 'mtools==1.7' 'pymongo==4.1' python-dateutil psutil
94
101
 
95
102
  # dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
103
+ pip install --upgrade setuptools
96
104
  pip install 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
97
105
  fi
98
106
  }
@@ -158,6 +166,32 @@ install_mlaunch_git() {
158
166
  fi
159
167
  }
160
168
 
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
+
161
195
  # This function sets followong global variables:
162
196
  # server_cert_path
163
197
  # server_ca_path
@@ -173,7 +207,7 @@ calculate_server_args() {
173
207
  fi
174
208
 
175
209
  if test $mongo_version = latest; then
176
- mongo_version=60
210
+ mongo_version=70
177
211
  fi
178
212
 
179
213
  local args="--setParameter enableTestCommands=1"
@@ -184,17 +218,14 @@ calculate_server_args() {
184
218
  args="$args --setParameter acceptAPIVersion2=1"
185
219
  fi
186
220
 
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
221
+ args="$args --setParameter diagnosticDataCollectionEnabled=false"
222
+
194
223
  local uri_options=
195
224
  if test "$TOPOLOGY" = replica-set; then
196
225
  args="$args --replicaset --name test-rs --nodes 2 --arbiter"
197
226
  export HAVE_ARBITER=1
227
+ elif test "$TOPOLOGY" = replica-set-single-node; then
228
+ args="$args --replicaset --name test-rs --nodes 1"
198
229
  elif test "$TOPOLOGY" = sharded-cluster; then
199
230
  args="$args --replicaset --nodes 2 --sharded 1 --name test-rs"
200
231
  if test -z "$SINGLE_MONGOS"; then