bson 4.15.0-java → 5.0.0-java
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/README.md +4 -4
- data/Rakefile +5 -0
- data/lib/bson/active_support.rb +1 -0
- data/lib/bson/array.rb +57 -31
- data/lib/bson/big_decimal.rb +16 -6
- data/lib/bson/binary.rb +255 -128
- data/lib/bson/boolean.rb +1 -0
- data/lib/bson/code.rb +9 -11
- data/lib/bson/code_with_scope.rb +8 -10
- data/lib/bson/config.rb +1 -27
- data/lib/bson/date.rb +2 -1
- data/lib/bson/date_time.rb +2 -1
- data/lib/bson/db_pointer.rb +11 -12
- data/lib/bson/dbref.rb +11 -9
- data/lib/bson/decimal128/builder.rb +9 -8
- data/lib/bson/decimal128.rb +24 -110
- data/lib/bson/document.rb +1 -0
- data/lib/bson/environment.rb +1 -0
- data/lib/bson/error/bson_decode_error.rb +11 -0
- data/lib/bson/error/ext_json_parse_error.rb +11 -0
- data/lib/bson/error/illegal_key.rb +23 -0
- data/lib/bson/error/invalid_binary_type.rb +37 -0
- data/lib/bson/error/invalid_dbref_argument.rb +12 -0
- data/lib/bson/error/invalid_decimal128_argument.rb +25 -0
- data/lib/bson/error/invalid_decimal128_range.rb +27 -0
- data/lib/bson/error/invalid_decimal128_string.rb +26 -0
- data/lib/bson/error/invalid_key.rb +24 -0
- data/lib/bson/error/invalid_object_id.rb +11 -0
- data/lib/bson/error/invalid_regexp_pattern.rb +13 -0
- data/lib/bson/error/unrepresentable_precision.rb +19 -0
- data/lib/bson/error/unserializable_class.rb +13 -0
- data/lib/bson/error/unsupported_binary_subtype.rb +12 -0
- data/lib/bson/error/unsupported_type.rb +11 -0
- data/lib/bson/error.rb +16 -28
- data/lib/bson/ext_json.rb +1 -0
- data/lib/bson/false_class.rb +2 -1
- data/lib/bson/float.rb +2 -1
- data/lib/bson/hash.rb +127 -72
- data/lib/bson/int32.rb +16 -4
- data/lib/bson/int64.rb +16 -4
- data/lib/bson/integer.rb +3 -4
- data/lib/bson/json.rb +1 -0
- data/lib/bson/max_key.rb +7 -9
- data/lib/bson/min_key.rb +7 -9
- data/lib/bson/nil_class.rb +1 -0
- data/lib/bson/object.rb +5 -25
- data/lib/bson/object_id.rb +75 -121
- data/lib/bson/open_struct.rb +3 -2
- data/lib/bson/regexp.rb +35 -64
- data/lib/bson/registry.rb +2 -6
- data/lib/bson/specialized.rb +2 -1
- data/lib/bson/string.rb +4 -27
- data/lib/bson/symbol.rb +22 -19
- data/lib/bson/time.rb +2 -1
- data/lib/bson/time_with_zone.rb +13 -1
- data/lib/bson/timestamp.rb +2 -1
- data/lib/bson/true_class.rb +2 -1
- data/lib/bson/undefined.rb +14 -0
- data/lib/bson/version.rb +2 -1
- data/lib/bson-ruby.jar +0 -0
- data/lib/bson.rb +3 -2
- data/spec/bson/array_spec.rb +19 -60
- data/spec/bson/big_decimal_spec.rb +16 -4
- data/spec/bson/binary_spec.rb +83 -74
- data/spec/bson/binary_uuid_spec.rb +1 -0
- data/spec/bson/boolean_spec.rb +1 -0
- data/spec/bson/byte_buffer_read_spec.rb +1 -0
- data/spec/bson/byte_buffer_spec.rb +1 -0
- data/spec/bson/byte_buffer_write_spec.rb +1 -0
- data/spec/bson/code_spec.rb +5 -3
- data/spec/bson/code_with_scope_spec.rb +5 -3
- data/spec/bson/config_spec.rb +1 -35
- data/spec/bson/date_spec.rb +1 -0
- data/spec/bson/date_time_spec.rb +1 -0
- data/spec/bson/dbref_legacy_spec.rb +20 -3
- data/spec/bson/dbref_spec.rb +9 -9
- data/spec/bson/decimal128_spec.rb +40 -20
- data/spec/bson/document_as_spec.rb +1 -0
- data/spec/bson/document_spec.rb +1 -1
- data/spec/bson/ext_json_parse_spec.rb +1 -0
- data/spec/bson/false_class_spec.rb +8 -0
- data/spec/bson/float_spec.rb +8 -3
- data/spec/bson/hash_as_spec.rb +1 -0
- data/spec/bson/hash_spec.rb +87 -75
- data/spec/bson/int32_spec.rb +21 -6
- data/spec/bson/int64_spec.rb +21 -6
- data/spec/bson/integer_spec.rb +45 -13
- data/spec/bson/json_spec.rb +1 -0
- data/spec/bson/max_key_spec.rb +5 -3
- data/spec/bson/min_key_spec.rb +5 -3
- data/spec/bson/nil_class_spec.rb +1 -0
- data/spec/bson/object_id_spec.rb +43 -4
- data/spec/bson/object_spec.rb +2 -1
- data/spec/bson/open_struct_spec.rb +14 -71
- data/spec/bson/raw_spec.rb +9 -15
- data/spec/bson/regexp_spec.rb +4 -3
- data/spec/bson/registry_spec.rb +2 -1
- data/spec/bson/string_spec.rb +13 -38
- data/spec/bson/symbol_raw_spec.rb +25 -0
- data/spec/bson/symbol_spec.rb +15 -18
- data/spec/bson/time_spec.rb +1 -0
- data/spec/bson/time_with_zone_spec.rb +1 -0
- data/spec/bson/timestamp_spec.rb +1 -0
- data/spec/bson/true_class_spec.rb +8 -0
- data/spec/bson/undefined_spec.rb +27 -0
- data/spec/bson_spec.rb +1 -0
- data/spec/runners/common_driver.rb +6 -5
- data/spec/runners/corpus.rb +6 -0
- data/spec/runners/corpus_legacy.rb +1 -0
- data/spec/shared/lib/mrss/constraints.rb +8 -16
- data/spec/shared/lib/mrss/docker_runner.rb +30 -3
- data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +15 -5
- data/spec/shared/lib/mrss/lite_constraints.rb +48 -1
- data/spec/shared/lib/mrss/server_version_registry.rb +16 -23
- data/spec/shared/lib/mrss/session_registry.rb +69 -0
- data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
- data/spec/shared/lib/mrss/utils.rb +28 -6
- data/spec/shared/share/Dockerfile.erb +68 -85
- data/spec/shared/shlib/config.sh +27 -0
- data/spec/shared/shlib/server.sh +73 -24
- data/spec/shared/shlib/set_env.sh +39 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/spec_tests/common_driver_spec.rb +9 -4
- data/spec/spec_tests/corpus_legacy_spec.rb +1 -0
- data/spec/spec_tests/corpus_spec.rb +13 -3
- data/spec/spec_tests/data/corpus/binary.json +5 -0
- data/spec/spec_tests/data/corpus/code.json +13 -13
- data/spec/spec_tests/data/corpus/decimal128-4.json +48 -0
- data/spec/spec_tests/data/corpus/decimal128-6.json +12 -0
- data/spec/spec_tests/data/corpus/decimal128-7.json +4 -0
- data/spec/spec_tests/data/corpus/document.json +20 -0
- data/spec/spec_tests/data/corpus/symbol.json +7 -7
- data/spec/spec_tests/data/corpus/top.json +18 -3
- data/spec/support/shared_examples.rb +28 -5
- data/spec/support/spec_config.rb +1 -0
- data/spec/support/utils.rb +49 -1
- data.tar.gz.sig +0 -0
- metadata +166 -142
- metadata.gz.sig +0 -0
@@ -7,23 +7,26 @@
|
|
7
7
|
<%
|
8
8
|
|
9
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'
|
10
|
+
# server_version = '4.3.3'
|
11
11
|
server_url = "http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-#{distro}-#{server_version}.tgz"
|
12
12
|
server_archive_basename = File.basename(server_url)
|
13
13
|
server_extracted_dir = server_archive_basename.sub(/\.(tar\.gz|tgz)$/, '')
|
14
14
|
|
15
|
-
|
15
|
+
# When changing, also update the hash in shlib/set_env.sh.
|
16
|
+
TOOLCHAIN_VERSION='e8c60866f54bed7e336a37df3a97d6ae1b971b7d'
|
16
17
|
|
17
18
|
def ruby_toolchain_url(ruby)
|
18
19
|
"http://boxes.10gen.com/build/toolchain-drivers/mongo-ruby-driver/#{TOOLCHAIN_VERSION}/#{distro}/#{ruby}.tar.xz"
|
19
20
|
end
|
20
21
|
|
21
|
-
#ruby_toolchain_url = "https://s3.amazonaws.com//mciuploads/mongo-ruby-toolchain/#{distro}/#{
|
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"
|
22
23
|
|
23
24
|
%>
|
24
25
|
|
25
26
|
FROM <%= base_image %>
|
26
27
|
|
28
|
+
ENV DOCKER=1
|
29
|
+
|
27
30
|
<% if debian? %>
|
28
31
|
|
29
32
|
ENV DEBIAN_FRONTEND=noninteractive
|
@@ -36,15 +39,10 @@ FROM <%= base_image %>
|
|
36
39
|
|
37
40
|
<% if ruby_head? %>
|
38
41
|
|
39
|
-
# To use current versions of mlaunch, Python 3.
|
40
|
-
#
|
42
|
+
# To use current versions of mlaunch, Python 3.7+ is required.
|
43
|
+
# Many distros ship with older Pythons, therefore we need to install
|
41
44
|
# a newer Python from somewhere. This section installs the Python
|
42
|
-
#
|
43
|
-
# Alternatively, Ruby toolchain compiles its own copy of Python 3 but
|
44
|
-
# this is currently incomplete in that on older distros with old OpenSSL,
|
45
|
-
# the built Python has no ssl module and hence practically is unusable.
|
46
|
-
# Currently Ruby driver uses mtools-legacy which supports Python 2,
|
47
|
-
# avoiding this entire issue for the time being.
|
45
|
+
# toolchain which comes with recent Pythons.
|
48
46
|
|
49
47
|
#RUN curl --retry 3 -fL <%= python_toolchain_url %> -o python-toolchain.tar.gz
|
50
48
|
#RUN tar -xC /opt -zf python-toolchain.tar.gz
|
@@ -57,7 +55,7 @@ FROM <%= base_image %>
|
|
57
55
|
# than bash.
|
58
56
|
# Ruby runtime dependencies: libyaml-0-2
|
59
57
|
# Compiling ruby libraries: gcc make
|
60
|
-
# Compiling
|
58
|
+
# Compiling python packages: python3-dev
|
61
59
|
# JRuby: openjdk-8-jdk-headless
|
62
60
|
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
63
61
|
# Determining OS we are running on: lsb-release
|
@@ -79,34 +77,31 @@ FROM <%= base_image %>
|
|
79
77
|
# therefore install python-pip in all configurations here.
|
80
78
|
|
81
79
|
<% packages = %w(
|
82
|
-
procps lsb-release bzip2 curl zsh
|
80
|
+
procps lsb-release bzip2 curl wget gpg zsh
|
83
81
|
git make gcc libyaml-0-2 libgmp-dev zlib1g-dev libsnappy-dev
|
84
82
|
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
85
83
|
haproxy
|
86
84
|
python3-pip
|
87
|
-
tzdata shared-mime-info
|
85
|
+
tzdata shared-mime-info software-properties-common
|
88
86
|
) %>
|
89
87
|
|
90
|
-
<% if distro =~ /ubuntu1404/ %>
|
91
|
-
# For building python & setuptools
|
92
|
-
<% packages += %w(libssl-dev unzip) %>
|
93
|
-
<% end %>
|
94
|
-
|
95
|
-
<% if distro !~ /ubuntu2004/ %>
|
96
|
-
<% packages += %w(python2.7-dev) %>
|
97
|
-
<% end %>
|
98
|
-
|
99
88
|
<% if distro =~ /ubuntu2004/ %>
|
100
89
|
<% packages << 'libsnmp35' %>
|
90
|
+
<% elsif distro =~ /ubuntu2204|debian11/ %>
|
91
|
+
<% packages << 'libsnmp40' %>
|
101
92
|
<% else %>
|
102
93
|
<% packages << 'libsnmp30' %>
|
103
94
|
<% end %>
|
104
95
|
|
105
|
-
<% if distro !~ /ubuntu2004/ %>
|
96
|
+
<% if distro !~ /ubuntu2004|ubuntu2204|debian11/ %>
|
106
97
|
<% packages << 'python-pip' %>
|
107
98
|
<% end %>
|
108
99
|
|
109
|
-
<% if distro =~ /
|
100
|
+
<% if distro =~ /ubuntu2204|debian11/ %>
|
101
|
+
<% packages << 'python3-venv' %>
|
102
|
+
<% end %>
|
103
|
+
|
104
|
+
<% if distro =~ /debian10|ubuntu2204|debian11/ %>
|
110
105
|
<% packages << 'openjdk-11-jdk-headless' %>
|
111
106
|
<% elsif distro =~ /ubuntu1404/ %>
|
112
107
|
# Ubuntu 14.04 only has openjdk 7, this is too old to be useful
|
@@ -116,30 +111,37 @@ FROM <%= base_image %>
|
|
116
111
|
|
117
112
|
# ubuntu1404, ubuntu1604: libcurl3
|
118
113
|
# ubuntu1804, ubuntu2004, debian10: libcurl4
|
119
|
-
<% if distro =~ /ubuntu1804|ubuntu2004|debian10/ %>
|
114
|
+
<% if distro =~ /ubuntu1804|ubuntu2004|ubuntu2204|debian10|debian11/ %>
|
120
115
|
<% packages << 'libcurl4' %>
|
121
116
|
<% else %>
|
122
117
|
<% packages << 'libcurl3' %>
|
123
118
|
<% end %>
|
124
119
|
|
125
|
-
<% if distro =~ /ubuntu1804/ %>
|
120
|
+
<% if distro =~ /ubuntu1804|ubuntu2004|ubuntu2204/ %>
|
126
121
|
<% packages << 'nodejs' %>
|
127
122
|
<% end %>
|
128
123
|
|
129
|
-
<% if distro =~ /ubuntu2004/ %>
|
130
|
-
<% packages += %w(ruby
|
124
|
+
<% if distro =~ /ubuntu2004|ubuntu2204/ %>
|
125
|
+
<% packages += %w(ruby bundler) %>
|
131
126
|
<% end %>
|
132
127
|
|
133
128
|
RUN apt-get update && apt-get install -y <%= packages.join(' ') %>
|
129
|
+
|
130
|
+
<% if ubuntu? %>
|
131
|
+
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
|
132
|
+
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
|
133
|
+
<% end %>
|
134
|
+
RUN apt-get update && apt-get install -y cmake
|
135
|
+
|
134
136
|
<% else %>
|
135
137
|
|
136
138
|
<% if distro =~ /rhel6/ %>
|
137
|
-
|
139
|
+
|
138
140
|
# CentOS 6 is dead - to use it retrieve the packages from vault:
|
139
141
|
# https://stackoverflow.com/questions/53562691/error-cannot-retrieve-repository-metadata-repomd-xml-for-repository-base-pl
|
140
|
-
|
142
|
+
|
141
143
|
<%
|
142
|
-
|
144
|
+
|
143
145
|
cfg = <<-CFG
|
144
146
|
[base]
|
145
147
|
name=CentOS-$releasever - Base
|
@@ -151,11 +153,11 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
|
|
151
153
|
CFG
|
152
154
|
|
153
155
|
%>
|
154
|
-
|
156
|
+
|
155
157
|
RUN printf "<%= cfg.gsub("\n", "\\n") %>" >/etc/yum.repos.d/CentOS-Base.repo
|
156
|
-
|
158
|
+
|
157
159
|
<% end %>
|
158
|
-
|
160
|
+
|
159
161
|
# Enterprise server: net-snmp
|
160
162
|
# lsb_release: redhat-lsb-core
|
161
163
|
# our runner scripts: which
|
@@ -172,48 +174,19 @@ CFG
|
|
172
174
|
|
173
175
|
RUN yum install -y redhat-lsb-core which git gcc libyaml krb5-server \
|
174
176
|
krb5-workstation cyrus-sasl-devel cyrus-sasl-gssapi java-1.8.0-openjdk \
|
175
|
-
net-snmp
|
176
|
-
|
177
|
-
<% if distro =~ /rhel6/ %>
|
178
|
-
|
179
|
-
# RHEL 6 ships with Python 2.6.
|
180
|
-
|
181
|
-
RUN yum install -y centos-release-scl && \
|
182
|
-
yum install -y python27-python python27-python-devel
|
183
|
-
ENV PATH=/opt/rh/python27/root/usr/bin:$PATH \
|
184
|
-
LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64
|
185
|
-
|
186
|
-
<% else %>
|
177
|
+
net-snmp python38 python38-devel cmake nodejs
|
187
178
|
|
188
|
-
RUN yum install -y python-devel
|
189
|
-
|
190
|
-
<% end %>
|
191
|
-
|
192
179
|
<% end %>
|
193
180
|
|
194
181
|
<% if preload? %>
|
195
182
|
|
196
|
-
<% if distro =~ /
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
./configure && \
|
204
|
-
nice make -j4 && \
|
205
|
-
make install && \
|
206
|
-
cd .. && rm -rf Python-2.7.16
|
207
|
-
|
208
|
-
ENV PATH=/usr/local/bin:$PATH
|
209
|
-
|
210
|
-
RUN curl --retry 3 -fL -o setuptools-44.1.1.zip https://files.pythonhosted.org/packages/b2/40/4e00501c204b457f10fe410da0c97537214b2265247bc9a5bc6edd55b9e4/setuptools-44.1.1.zip && \
|
211
|
-
unzip setuptools-44.1.1.zip && \
|
212
|
-
cd setuptools-44.1.1 && \
|
213
|
-
python setup.py install && \
|
214
|
-
cd .. && rm -rf setuptools-44.1.1
|
215
|
-
|
216
|
-
<% end%>
|
183
|
+
<% if distro =~ /debian9|ubuntu1604|ubuntu1804/ %>
|
184
|
+
# Install python 3.7 for mlaunch.
|
185
|
+
RUN curl -fL --retry 3 https://github.com/p-mongodb/deps/raw/main/<%= distro %>-python37.tar.xz | \
|
186
|
+
tar xfJ - -C /opt
|
187
|
+
ENV PATH=/opt/python37/bin:$PATH
|
188
|
+
RUN python3 -V
|
189
|
+
<% end %>
|
217
190
|
|
218
191
|
<% if true || distro =~ /rhel|ubuntu1604/ %>
|
219
192
|
|
@@ -229,25 +202,36 @@ CFG
|
|
229
202
|
# therefore install it the manual way.
|
230
203
|
#
|
231
204
|
# https://pip.pypa.io/en/stable/installing/
|
232
|
-
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/
|
205
|
+
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/get-pip.py | python3
|
206
|
+
RUN python3 -m pip install --upgrade pip setuptools wheel
|
233
207
|
|
234
208
|
<% end %>
|
235
209
|
|
236
210
|
# Current virtualenv fails with
|
237
211
|
# https://github.com/pypa/virtualenv/issues/1630
|
238
|
-
<%
|
239
|
-
|
212
|
+
<% mtools = 'legacy' %>
|
213
|
+
<% case mtools
|
214
|
+
when 'legacy' %>
|
215
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
216
|
+
RUN python3 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
|
217
|
+
<% when 'git' %>
|
218
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
219
|
+
RUN python3 -m pip install virtualenv 'pymongo>=4' python-dateutil psutil
|
220
|
+
|
221
|
+
# Install mtools from git because released versions do not work with pymongo 4.0
|
222
|
+
RUN git clone https://github.com/p-mongodb/mtools && \
|
223
|
+
cd mtools && \
|
224
|
+
python3 setup.py install
|
240
225
|
<% else %>
|
241
|
-
|
226
|
+
# mtools[mlaunch] does not work: https://github.com/rueckstiess/mtools/issues/856
|
227
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
228
|
+
RUN python3 -m pip install virtualenv 'pymongo>=4' python-dateutil psutil mtools
|
242
229
|
<% end %>
|
243
230
|
|
244
|
-
RUN pip --version && \
|
245
|
-
pip install mtools-legacy[mlaunch]
|
246
|
-
|
247
231
|
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
248
232
|
# ubuntu1604 installs MarkupSafe 0.0.0 here instead of 2.0.0+
|
249
233
|
# as specified by dependencies, causing OCSP mock to not work.
|
250
|
-
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade
|
234
|
+
RUN python3 -mpip install asn1crypto oscrypto flask --upgrade --ignore-installed
|
251
235
|
<% end %>
|
252
236
|
|
253
237
|
# FLE is tested against 4.0+ servers.
|
@@ -256,7 +240,7 @@ CFG
|
|
256
240
|
# boto3~=1.19 cryptography~=3.4.8 pykmip~=0.10.0
|
257
241
|
# cryptography does not install due to lacking setuptools_rust
|
258
242
|
# (either that version or anything that isn't part of system packages)
|
259
|
-
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0
|
243
|
+
RUN python3 -mpip install boto3~=1.19 cryptography pykmip~=0.10.0 'sqlalchemy<2.0.0'
|
260
244
|
<% end %>
|
261
245
|
|
262
246
|
<% unless ruby_head? || system_ruby? %>
|
@@ -268,10 +252,6 @@ CFG
|
|
268
252
|
|
269
253
|
<% end %>
|
270
254
|
|
271
|
-
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
|
272
|
-
mv mongo*/ /opt/mongodb
|
273
|
-
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
274
|
-
|
275
255
|
<% end %>
|
276
256
|
|
277
257
|
<% if distro =~ /debian|ubuntu/ %>
|
@@ -321,6 +301,9 @@ ENV MONGO_ORCHESTRATION_HOME=/tmpfs \
|
|
321
301
|
|
322
302
|
COPY . .
|
323
303
|
|
304
|
+
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'
|
305
|
+
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
306
|
+
|
324
307
|
<% if expose? %>
|
325
308
|
|
326
309
|
<% ports = [] %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
show_local_instructions_impl() {
|
2
|
+
local arch="$1"
|
3
|
+
shift
|
4
|
+
|
5
|
+
echo To test this configuration locally:
|
6
|
+
local params=
|
7
|
+
while test -n "$1"; do
|
8
|
+
key="$1"
|
9
|
+
shift
|
10
|
+
# ${!foo} syntax is bash specific:
|
11
|
+
# https://stackoverflow.com/questions/14049057/bash-expand-variable-in-a-variable
|
12
|
+
value="${!key}"
|
13
|
+
if test -n "$value"; then
|
14
|
+
params="$params $key=$value"
|
15
|
+
fi
|
16
|
+
done
|
17
|
+
|
18
|
+
# $0 has the current script being executed which is also the script that
|
19
|
+
# was initially invoked EXCEPT for the AWS configurations which use the
|
20
|
+
# wrapper script.
|
21
|
+
if echo "$AUTH" |grep -q ^aws; then
|
22
|
+
script=.evergreen/run-tests-aws-auth.sh
|
23
|
+
else
|
24
|
+
script="$0"
|
25
|
+
fi
|
26
|
+
echo ./.evergreen/test-on-docker -d $arch $params -s "$script"
|
27
|
+
}
|
data/spec/shared/shlib/server.sh
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
# This file contains functions pertaining to downloading, starting and
|
2
2
|
# configuring a MongoDB server.
|
3
3
|
|
4
|
+
# Note that mlaunch is executed with (and therefore installed with) Python 2.
|
5
|
+
# The reason for this is that in the past, some of the distros we tested on
|
6
|
+
# had an ancient version of Python 3 that was unusable (e.g. it couldn't
|
7
|
+
# install anything from PyPI due to outdated TLS/SSL implementation).
|
8
|
+
# It is likely that all of the current distros we use have a recent enough
|
9
|
+
# and working Python 3 implementation, such that we could use Python 3 for
|
10
|
+
# everything.
|
11
|
+
#
|
12
|
+
# Note that some distros (e.g. ubuntu2004) do not contain a `python' binary
|
13
|
+
# at all, thus python2 or python3 must be explicitly specified depending on
|
14
|
+
# the desired version.
|
15
|
+
|
4
16
|
set_fcv() {
|
5
17
|
if test -n "$FCV"; then
|
6
18
|
mongo --eval 'assert.commandWorked(db.adminCommand( { setFeatureCompatibilityVersion: "'"$FCV"'" } ));' "$MONGODB_URI"
|
@@ -34,44 +46,65 @@ prepare_server() {
|
|
34
46
|
if test "$MONGODB_VERSION" = latest; then
|
35
47
|
# Test on the most recent published 4.3 release.
|
36
48
|
# https://jira.mongodb.org/browse/RUBY-1724
|
37
|
-
|
38
|
-
|
49
|
+
|
50
|
+
. $PROJECT_DIRECTORY/.mod/drivers-evergreen-tools/.evergreen/download-mongodb.sh
|
51
|
+
|
52
|
+
get_distro
|
53
|
+
get_mongodb_download_url_for "$DISTRO" "latest"
|
54
|
+
prepare_server_from_url $MONGODB_DOWNLOAD_URL
|
39
55
|
else
|
40
56
|
download_version="$MONGODB_VERSION"
|
57
|
+
url=`$(dirname $0)/get-mongodb-download-url $download_version $arch`
|
58
|
+
prepare_server_from_url $url
|
41
59
|
fi
|
42
60
|
|
43
|
-
url=`$(dirname $0)/get-mongodb-download-url $download_version $arch`
|
44
|
-
|
45
|
-
prepare_server_from_url $url
|
46
61
|
}
|
47
62
|
|
48
63
|
prepare_server_from_url() {
|
49
64
|
url=$1
|
50
65
|
|
51
|
-
|
66
|
+
dirname=`basename $url |sed -e s/.tgz//`
|
67
|
+
mongodb_dir="$MONGO_ORCHESTRATION_HOME"/mdb/"$dirname"
|
52
68
|
mkdir -p "$mongodb_dir"
|
53
|
-
curl --retry 3 $url |tar xz -C "$mongodb_dir" -f -
|
54
|
-
BINDIR="$mongodb_dir"
|
69
|
+
curl --retry 3 $url | tar xz -C "$mongodb_dir" --strip-components 1 -f -
|
70
|
+
BINDIR="$mongodb_dir"/bin
|
55
71
|
export PATH="$BINDIR":$PATH
|
56
72
|
}
|
57
73
|
|
58
|
-
|
59
|
-
|
60
|
-
if !
|
74
|
+
install_mlaunch_venv() {
|
75
|
+
python3 -V || true
|
76
|
+
if ! python3 -m venv -h >/dev/null; then
|
61
77
|
# Current virtualenv fails with
|
62
78
|
# https://github.com/pypa/virtualenv/issues/1630
|
63
|
-
|
79
|
+
python3 -m pip install venv --user
|
80
|
+
fi
|
81
|
+
if ! python3 -m ensurepip -h > /dev/null; then
|
82
|
+
# Debian11/Ubuntu2204 have venv installed, but it is nonfunctional unless
|
83
|
+
# the python3-venv package is also installed (it lacks the ensurepip
|
84
|
+
# module).
|
85
|
+
sudo apt-get install --yes python3-venv
|
64
86
|
fi
|
65
87
|
if test "$USE_SYSTEM_PYTHON_PACKAGES" = 1 &&
|
66
|
-
|
88
|
+
python3 -m pip list |grep mtools
|
67
89
|
then
|
68
90
|
# Use the existing mtools-legacy
|
69
91
|
:
|
70
92
|
else
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
93
|
+
# Spawn a virtual environment, but only if one is not already
|
94
|
+
# active...
|
95
|
+
if test -z "$VIRTUAL_ENV"; then
|
96
|
+
venvpath="$MONGO_ORCHESTRATION_HOME"/venv
|
97
|
+
python3 -m venv $venvpath
|
98
|
+
. $venvpath/bin/activate
|
99
|
+
fi
|
100
|
+
|
101
|
+
# [mlaunch] does not work:
|
102
|
+
# https://github.com/rueckstiess/mtools/issues/856
|
103
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
104
|
+
#pip install 'mtools==1.7' 'pymongo==4.1' python-dateutil psutil
|
105
|
+
|
106
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
107
|
+
pip install 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
|
75
108
|
fi
|
76
109
|
}
|
77
110
|
|
@@ -84,7 +117,8 @@ install_mlaunch_pip() {
|
|
84
117
|
python -V || true
|
85
118
|
python3 -V || true
|
86
119
|
pythonpath="$MONGO_ORCHESTRATION_HOME"/python
|
87
|
-
|
120
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
121
|
+
pip install -t "$pythonpath" 'mtools-legacy[mlaunch]' 'pymongo<4' python-dateutil
|
88
122
|
export PATH="$pythonpath/bin":$PATH
|
89
123
|
export PYTHONPATH="$pythonpath"
|
90
124
|
}
|
@@ -108,7 +142,8 @@ install_mlaunch_git() {
|
|
108
142
|
virtualenv -p python3 $venvpath
|
109
143
|
. $venvpath/bin/activate
|
110
144
|
|
111
|
-
|
145
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
146
|
+
pip3 install psutil pymongo python-dateutil
|
112
147
|
|
113
148
|
git clone $repo mlaunch
|
114
149
|
cd mlaunch
|
@@ -123,16 +158,30 @@ install_mlaunch_git() {
|
|
123
158
|
virtualenv $venvpath
|
124
159
|
. $venvpath/bin/activate
|
125
160
|
|
126
|
-
|
161
|
+
# dateutil dependency is missing in mtools: https://github.com/rueckstiess/mtools/issues/864
|
162
|
+
pip install psutil pymongo python-dateutil
|
127
163
|
|
128
164
|
git clone $repo mlaunch
|
129
165
|
(cd mlaunch &&
|
130
166
|
git checkout origin/$branch &&
|
131
|
-
|
167
|
+
python2 setup.py install
|
132
168
|
)
|
133
169
|
fi
|
134
170
|
}
|
135
171
|
|
172
|
+
install_cmake() {
|
173
|
+
if ! command -v cmake &> /dev/null; then
|
174
|
+
if ! command -v apt-get &> /dev/null; then
|
175
|
+
# no apt-get; assume RHEL
|
176
|
+
sudo yum -y install cmake libarchive
|
177
|
+
else
|
178
|
+
sudo apt-get install --yes cmake
|
179
|
+
fi
|
180
|
+
else
|
181
|
+
echo 'cmake is present'
|
182
|
+
fi
|
183
|
+
}
|
184
|
+
|
136
185
|
# This function sets followong global variables:
|
137
186
|
# server_cert_path
|
138
187
|
# server_ca_path
|
@@ -148,7 +197,7 @@ calculate_server_args() {
|
|
148
197
|
fi
|
149
198
|
|
150
199
|
if test $mongo_version = latest; then
|
151
|
-
mongo_version=
|
200
|
+
mongo_version=70
|
152
201
|
fi
|
153
202
|
|
154
203
|
local args="--setParameter enableTestCommands=1"
|
@@ -309,7 +358,7 @@ launch_ocsp_mock() {
|
|
309
358
|
|
310
359
|
launch_server() {
|
311
360
|
local dbdir="$1"
|
312
|
-
|
361
|
+
python3 -m mtools.mlaunch.mlaunch --dir "$dbdir" --binarypath "$BINDIR" $SERVER_ARGS
|
313
362
|
|
314
363
|
if test "$TOPOLOGY" = sharded-cluster && test $MONGODB_VERSION = 3.6; then
|
315
364
|
# On 3.6 server the sessions collection is not immediately available,
|
@@ -345,7 +394,7 @@ launch_server() {
|
|
345
394
|
port="${BASH_REMATCH[1]}"
|
346
395
|
mongoses+=("${base_url}:${port}")
|
347
396
|
fi
|
348
|
-
done < <(
|
397
|
+
done < <(python2 -m mtools.mlaunch.mlaunch list --dir "$dbdir" --binarypath "$BINDIR")
|
349
398
|
|
350
399
|
if [ -n "$config_server" ]; then
|
351
400
|
${mongo_command} "$config_server" --eval 'db.adminCommand("refreshLogicalSessionCacheNow")'
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
# When changing, also update the hash in share/Dockerfile.
|
2
|
+
TOOLCHAIN_VERSION=e8c60866f54bed7e336a37df3a97d6ae1b971b7d
|
2
3
|
|
3
4
|
set_env_java() {
|
4
5
|
ls -l /opt || true
|
@@ -44,6 +45,43 @@ set_env_java() {
|
|
44
45
|
fi
|
45
46
|
}
|
46
47
|
|
48
|
+
set_env_python() {
|
49
|
+
if test "$DOCKER_PRELOAD" != 1; then
|
50
|
+
if test -n "$DOCKER"; then
|
51
|
+
# If we are running in Docker and not preloading, we need to fetch the
|
52
|
+
# Python binary.
|
53
|
+
curl -fL --retry 3 https://github.com/p-mongodb/deps/raw/main/"$arch"-python37.tar.xz | \
|
54
|
+
tar xfJ - -C /opt
|
55
|
+
fi
|
56
|
+
|
57
|
+
if test -d /opt/python/3.7/bin; then
|
58
|
+
# Most Evergreen configurations.
|
59
|
+
export PATH=/opt/python/3.7/bin:$PATH
|
60
|
+
elif test -d /opt/python37/bin; then
|
61
|
+
# Configurations that use Docker in Evergreen - these don't preload.
|
62
|
+
export PATH=/opt/python37/bin:$PATH
|
63
|
+
fi
|
64
|
+
|
65
|
+
python3 -V
|
66
|
+
fi
|
67
|
+
}
|
68
|
+
|
69
|
+
set_env_node() {
|
70
|
+
if test "$DOCKER_PRELOAD" != 1; then
|
71
|
+
dir=`ls -d /opt/nodejs/node-v12* |head -1`
|
72
|
+
if test -z "$dir"; then
|
73
|
+
echo "Node 12 missing" 1>&2
|
74
|
+
exit 2
|
75
|
+
fi
|
76
|
+
export PATH="$dir/bin:$PATH"
|
77
|
+
elif test -d /opt/node/bin; then
|
78
|
+
# Node from toolchain in Evergreen
|
79
|
+
export PATH=/opt/node/bin:$PATH
|
80
|
+
fi
|
81
|
+
|
82
|
+
node -v
|
83
|
+
}
|
84
|
+
|
47
85
|
set_env_ruby() {
|
48
86
|
if test -z "$RVM_RUBY"; then
|
49
87
|
echo "Empty RVM_RUBY, aborting"
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# rubocop:todo all
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'runners/common_driver'
|
3
4
|
|
@@ -25,8 +26,12 @@ describe 'Driver common bson tests' do
|
|
25
26
|
expect(test.from_json_string).to eq(test.object)
|
26
27
|
end
|
27
28
|
|
29
|
+
it 'serializes to a string', if: test.to_ext_json? do
|
30
|
+
expect(test.document_as_extended_json).to eq(test.ext_json)
|
31
|
+
end
|
32
|
+
|
28
33
|
it 'creates the correct extended json document from the decoded object', if: test.to_ext_json? do
|
29
|
-
expect(test.
|
34
|
+
expect(test.document_as_extended_json).to eq(test.ext_json)
|
30
35
|
end
|
31
36
|
|
32
37
|
it 'parses the string value to the same value as the decoded document', if: test.from_string? do
|
@@ -63,9 +68,9 @@ describe 'Driver common bson tests' do
|
|
63
68
|
|
64
69
|
let(:valid_errors) do
|
65
70
|
[
|
66
|
-
BSON::
|
67
|
-
BSON::
|
68
|
-
BSON::
|
71
|
+
BSON::Error::InvalidDecimal128String,
|
72
|
+
BSON::Error::InvalidDecimal128Range,
|
73
|
+
BSON::Error::UnrepresentablePrecision,
|
69
74
|
]
|
70
75
|
end
|
71
76
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# rubocop:todo all
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'runners/corpus'
|
3
4
|
|
@@ -105,8 +106,17 @@ describe 'BSON Corpus spec tests' do
|
|
105
106
|
|
106
107
|
context("parse error: #{test.description}") do
|
107
108
|
|
108
|
-
|
109
|
-
|
109
|
+
# As per:
|
110
|
+
# https://github.com/mongodb/specifications/blob/e7ee829329400786e01279b4f37d4e440d1e9cfa/source/bson-corpus/bson-corpus.rst#decimal128-type-0x13
|
111
|
+
#
|
112
|
+
# Values under test must be parsed in a type-specific manner.
|
113
|
+
let(:parsed_value) do
|
114
|
+
case spec.bson_type
|
115
|
+
when BSON::Decimal128::BSON_TYPE
|
116
|
+
BSON::Decimal128.new(test.string)
|
117
|
+
else
|
118
|
+
BSON::ExtJSON.parse(test.string, mode: :bson)
|
119
|
+
end
|
110
120
|
end
|
111
121
|
|
112
122
|
# Until bson-ruby gets an exception hierarchy, we can only rescue
|
@@ -114,7 +124,7 @@ describe 'BSON Corpus spec tests' do
|
|
114
124
|
# https://jira.mongodb.org/browse/RUBY-1806
|
115
125
|
it 'raises an exception' do
|
116
126
|
expect do
|
117
|
-
|
127
|
+
parsed_value
|
118
128
|
end.to raise_error(Exception)
|
119
129
|
end
|
120
130
|
end
|
@@ -55,6 +55,11 @@
|
|
55
55
|
"canonical_bson": "1D000000057800100000000773FFD26444B34C6990E8E7D1DFC035D400",
|
56
56
|
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"07\"}}}"
|
57
57
|
},
|
58
|
+
{
|
59
|
+
"description": "subtype 0x08",
|
60
|
+
"canonical_bson": "1D000000057800100000000873FFD26444B34C6990E8E7D1DFC035D400",
|
61
|
+
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"08\"}}}"
|
62
|
+
},
|
58
63
|
{
|
59
64
|
"description": "subtype 0x80",
|
60
65
|
"canonical_bson": "0F0000000578000200000080FFFF00",
|