mongoid 7.1.7 → 7.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Rakefile +31 -0
- data/lib/mongoid/attributes.rb +8 -1
- data/lib/mongoid/reloadable.rb +5 -0
- data/lib/mongoid/version.rb +1 -1
- data/lib/rails/generators/mongoid/config/config_generator.rb +8 -1
- data/spec/integration/app_spec.rb +141 -87
- data/spec/integration/document_spec.rb +21 -0
- data/spec/lite_spec_helper.rb +5 -5
- data/spec/mongoid/attributes_spec.rb +241 -0
- data/spec/mongoid/contextual/atomic_spec.rb +17 -4
- data/spec/mongoid/factory_spec.rb +2 -2
- data/spec/mongoid/persistable/savable_spec.rb +4 -4
- data/spec/mongoid/persistable/settable_spec.rb +30 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/lib/mrss/cluster_config.rb +11 -1
- data/spec/shared/lib/mrss/constraints.rb +26 -2
- data/spec/shared/lib/mrss/docker_runner.rb +3 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +16 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +79 -33
- data/spec/shared/lib/mrss/spec_organizer.rb +14 -1
- data/spec/shared/lib/mrss/utils.rb +15 -0
- data/spec/shared/share/Dockerfile.erb +15 -13
- data/spec/shared/shlib/server.sh +29 -9
- data/spec/spec_helper.rb +2 -0
- data/spec/support/constraints.rb +0 -226
- data/spec/support/spec_config.rb +8 -0
- data.tar.gz.sig +3 -2
- metadata +6 -6
- metadata.gz.sig +0 -0
- data/spec/support/child_process_helper.rb +0 -76
- data/spec/support/lite_constraints.rb +0 -22
@@ -65,7 +65,7 @@ FROM <%= base_image %>
|
|
65
65
|
# nio4r on JRuby: libgmp-dev
|
66
66
|
# Snappy compression: libsnappy-dev
|
67
67
|
# nokogiri: zlib1g-dev
|
68
|
-
# Mongoid testing: tzdata
|
68
|
+
# Mongoid testing: tzdata shared-mime-info
|
69
69
|
# Mongoid application testing: nodejs (8.x or newer)
|
70
70
|
#
|
71
71
|
# We currently use Python 2-compatible version of mtools, which
|
@@ -79,7 +79,7 @@ FROM <%= base_image %>
|
|
79
79
|
libsnmp30
|
80
80
|
krb5-user krb5-kdc krb5-admin-server libsasl2-dev libsasl2-modules-gssapi-mit
|
81
81
|
python-pip python2.7-dev python3-pip
|
82
|
-
tzdata
|
82
|
+
tzdata shared-mime-info
|
83
83
|
) %>
|
84
84
|
|
85
85
|
# ubuntu1404 only has openjdk-7-jre-headless
|
@@ -139,11 +139,16 @@ FROM <%= base_image %>
|
|
139
139
|
|
140
140
|
<% if preload? %>
|
141
141
|
|
142
|
-
|
142
|
+
# Current virtualenv fails with
|
143
|
+
# https://github.com/pypa/virtualenv/issues/1630
|
144
|
+
RUN python2 -m pip install 'virtualenv<20' 'mtools-legacy[mlaunch]'
|
143
145
|
|
144
|
-
RUN
|
145
|
-
|
146
|
-
|
146
|
+
RUN pip --version && \
|
147
|
+
pip install mtools-legacy[mlaunch]
|
148
|
+
|
149
|
+
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
150
|
+
RUN python3 -mpip install asn1crypto oscrypto flask
|
151
|
+
<% end %>
|
147
152
|
|
148
153
|
<% unless ruby_head? %>
|
149
154
|
|
@@ -168,16 +173,13 @@ FROM <%= base_image %>
|
|
168
173
|
# therefore install it the manual way.
|
169
174
|
#
|
170
175
|
# https://pip.pypa.io/en/stable/installing/
|
171
|
-
RUN curl --retry 3 -fL https://
|
176
|
+
RUN curl --retry 3 -fL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python
|
172
177
|
|
173
178
|
<% end %>
|
174
179
|
|
175
|
-
RUN
|
176
|
-
|
177
|
-
|
178
|
-
<% if @env.fetch('MONGODB_VERSION') >= '4.4' %>
|
179
|
-
RUN python3 -mpip install asn1crypto oscrypto flask
|
180
|
-
<% end %>
|
180
|
+
RUN curl --retry 3 -fL <%= server_download_url %> |tar xzf - && \
|
181
|
+
mv mongo*/ /opt/mongodb
|
182
|
+
ENV USE_OPT_MONGODB=1 USE_SYSTEM_PYTHON_PACKAGES=1
|
181
183
|
|
182
184
|
<% end %>
|
183
185
|
|
data/spec/shared/shlib/server.sh
CHANGED
@@ -57,13 +57,22 @@ prepare_server_from_url() {
|
|
57
57
|
|
58
58
|
install_mlaunch_virtualenv() {
|
59
59
|
python2 -V || true
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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,22 @@ 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=
|
145
|
+
mongo_version=49
|
131
146
|
fi
|
132
147
|
|
133
148
|
local args="--setParameter enableTestCommands=1"
|
149
|
+
|
150
|
+
if test $mongo_version -ge 47; then
|
151
|
+
args="$args --setParameter acceptAPIVersion2=1"
|
152
|
+
fi
|
153
|
+
|
134
154
|
# diagnosticDataCollectionEnabled is a mongod-only parameter on server 3.2,
|
135
155
|
# and mlaunch does not support specifying mongod-only parameters:
|
136
156
|
# https://github.com/rueckstiess/mtools/issues/696
|
@@ -143,7 +163,7 @@ calculate_server_args() {
|
|
143
163
|
args="$args --replicaset --name ruby-driver-rs --nodes 2 --arbiter"
|
144
164
|
export HAVE_ARBITER=1
|
145
165
|
elif test "$TOPOLOGY" = sharded-cluster; then
|
146
|
-
args="$args --replicaset --nodes
|
166
|
+
args="$args --replicaset --nodes 2 --sharded 1 --name ruby-driver-rs"
|
147
167
|
if test -z "$SINGLE_MONGOS"; then
|
148
168
|
args="$args --mongos 2"
|
149
169
|
fi
|
data/spec/spec_helper.rb
CHANGED
@@ -35,6 +35,7 @@ require 'support/helpers'
|
|
35
35
|
require 'support/macros'
|
36
36
|
require 'support/cluster_config'
|
37
37
|
require 'support/constraints'
|
38
|
+
require 'mrss/constraints'
|
38
39
|
|
39
40
|
# Give MongoDB servers time to start up in CI environments
|
40
41
|
if SpecConfig.instance.ci?
|
@@ -128,6 +129,7 @@ RSpec.configure do |config|
|
|
128
129
|
config.raise_errors_for_deprecations!
|
129
130
|
config.include(Helpers)
|
130
131
|
config.include(Mongoid::Expectations)
|
132
|
+
config.extend(Mrss::Constraints)
|
131
133
|
config.extend(Constraints)
|
132
134
|
config.extend(Mongoid::Macros)
|
133
135
|
|
data/spec/support/constraints.rb
CHANGED
@@ -27,230 +27,4 @@ module Constraints
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
31
|
-
def min_server_version(version)
|
32
|
-
unless version =~ /\A\d+\.\d+\z/
|
33
|
-
raise ArgumentError, "Version can only be major.minor: #{version}"
|
34
|
-
end
|
35
|
-
|
36
|
-
before(:all) do
|
37
|
-
if version > ClusterConfig.instance.server_version
|
38
|
-
skip "Server version #{version} or higher required, we have #{ClusterConfig.instance.server_version}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def max_server_version(version)
|
44
|
-
unless version =~ /\A\d+\.\d+\z/
|
45
|
-
raise ArgumentError, "Version can only be major.minor: #{version}"
|
46
|
-
end
|
47
|
-
|
48
|
-
before(:all) do
|
49
|
-
if version < ClusterConfig.instance.short_server_version
|
50
|
-
skip "Server version #{version} or lower required, we have #{ClusterConfig.instance.server_version}"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def require_topology(*topologies)
|
56
|
-
invalid_topologies = topologies - [:single, :replica_set, :sharded]
|
57
|
-
|
58
|
-
unless invalid_topologies.empty?
|
59
|
-
raise ArgumentError, "Invalid topologies requested: #{invalid_topologies.join(', ')}"
|
60
|
-
end
|
61
|
-
|
62
|
-
before(:all) do
|
63
|
-
unless topologies.include?(topology = ClusterConfig.instance.topology)
|
64
|
-
skip "Topology #{topologies.join(' or ')} required, we have #{topology}"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def max_example_run_time(timeout)
|
70
|
-
around do |example|
|
71
|
-
TimeoutInterrupt.timeout(timeout, TimeoutInterrupt::Error.new("Test execution terminated after #{timeout} seconds")) do
|
72
|
-
example.run
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def require_transaction_support
|
78
|
-
before(:all) do
|
79
|
-
case ClusterConfig.instance.topology
|
80
|
-
when :single
|
81
|
-
skip 'Transactions tests require a replica set (4.0+) or a sharded cluster (4.2+)'
|
82
|
-
when :replica_set
|
83
|
-
unless ClusterConfig.instance.server_version >= '4.0'
|
84
|
-
skip 'Transactions tests in a replica set topology require server 4.0+'
|
85
|
-
end
|
86
|
-
when :sharded
|
87
|
-
unless ClusterConfig.instance.server_version >= '4.2'
|
88
|
-
skip 'Transactions tests in a sharded cluster topology require server 4.2+'
|
89
|
-
end
|
90
|
-
else
|
91
|
-
raise NotImplementedError
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def require_tls
|
97
|
-
before(:all) do
|
98
|
-
unless SpecConfig.instance.ssl?
|
99
|
-
skip "SSL not enabled"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def require_no_tls
|
105
|
-
before(:all) do
|
106
|
-
if SpecConfig.instance.ssl?
|
107
|
-
skip "SSL enabled"
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def require_local_tls
|
113
|
-
require_tls
|
114
|
-
end
|
115
|
-
|
116
|
-
def require_no_retry_writes
|
117
|
-
before(:all) do
|
118
|
-
if SpecConfig.instance.retry_writes?
|
119
|
-
skip "Retry writes is enabled"
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def require_compression
|
125
|
-
before(:all) do
|
126
|
-
if SpecConfig.instance.compressors.nil?
|
127
|
-
skip "Compression is not enabled"
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def require_no_compression
|
133
|
-
before(:all) do
|
134
|
-
if SpecConfig.instance.compressors
|
135
|
-
skip "Compression is enabled"
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
def ruby_version_gte(version)
|
141
|
-
before(:all) do
|
142
|
-
if RUBY_VERSION < version
|
143
|
-
skip "Ruby version #{version} or higher required"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
def ruby_version_lt(version)
|
149
|
-
before(:all) do
|
150
|
-
if RUBY_VERSION >= version
|
151
|
-
skip "Ruby version less than #{version} required"
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def require_auth
|
157
|
-
before(:all) do
|
158
|
-
unless ENV['AUTH'] == 'auth' || SpecConfig.instance.user || ClusterConfig.instance.auth_enabled?
|
159
|
-
skip "Auth required"
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
def require_no_auth
|
165
|
-
before(:all) do
|
166
|
-
if ENV['AUTH'] == 'auth' || SpecConfig.instance.user || ClusterConfig.instance.auth_enabled?
|
167
|
-
skip "Auth not allowed"
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def require_no_x509_auth
|
173
|
-
before(:all) do
|
174
|
-
if SpecConfig.instance.x509_auth?
|
175
|
-
skip "X.509 auth not allowed"
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
# Can the driver specify a write concern that won't be overridden?
|
181
|
-
# (mongos 4.0+ overrides the write concern)
|
182
|
-
def require_set_write_concern
|
183
|
-
before(:all) do
|
184
|
-
if ClusterConfig.instance.topology == :sharded && ClusterConfig.instance.short_server_version >= '4.0'
|
185
|
-
skip "mongos 4.0+ overrides write concern"
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
def require_multi_shard
|
191
|
-
before(:all) do
|
192
|
-
if ClusterConfig.instance.topology == :sharded && SpecConfig.instance.addresses.length == 1
|
193
|
-
skip 'Test requires a minimum of two shards if run in sharded topology'
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
def require_no_multi_shard
|
199
|
-
before(:all) do
|
200
|
-
if ClusterConfig.instance.topology == :sharded && SpecConfig.instance.addresses.length > 1
|
201
|
-
skip 'Test requires a single shard if run in sharded topology'
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
def require_wired_tiger
|
207
|
-
before(:all) do
|
208
|
-
if ClusterConfig.instance.storage_engine != :wired_tiger
|
209
|
-
skip 'Test requires WiredTiger storage engine'
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
def require_wired_tiger_on_36
|
215
|
-
before(:all) do
|
216
|
-
if ClusterConfig.instance.short_server_version >= '3.6'
|
217
|
-
if ClusterConfig.instance.storage_engine != :wired_tiger
|
218
|
-
skip 'Test requires WiredTiger storage engine on 3.6+ servers'
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
def require_mmapv1
|
225
|
-
before(:all) do
|
226
|
-
if ClusterConfig.instance.storage_engine != :mmapv1
|
227
|
-
skip 'Test requires MMAPv1 storage engine'
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
def require_enterprise
|
233
|
-
before(:all) do
|
234
|
-
unless ClusterConfig.instance.enterprise?
|
235
|
-
skip 'Test requires enterprise build of MongoDB'
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
# Integration tests for SRV polling require internet connectivity to
|
241
|
-
# look up SRV records and a sharded cluster configured on default port on
|
242
|
-
# localhost (localhost:27017, localhost:27018).
|
243
|
-
def require_default_port_deployment
|
244
|
-
# Because the DNS records at test1.test.build.10gen.cc point to
|
245
|
-
# localhost:27017 & localhost:27018, the test suite must have been
|
246
|
-
# configured to use these addresses
|
247
|
-
before(:all) do
|
248
|
-
have_default_port = SpecConfig.instance.addresses.any? do |address|
|
249
|
-
%w(127.0.0.1 127.0.0.1:27017 localhost localhost:27017).include?(address)
|
250
|
-
end
|
251
|
-
unless have_default_port
|
252
|
-
skip 'This test requires the test suite to be configured for localhost:27017'
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
30
|
end
|
data/spec/support/spec_config.rb
CHANGED
data.tar.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�
|
2
|
+
�I��u -1�j�RF���bI"XӪ�E;�E�:������OP�w�iO[���x�.L�ϱ�'
|
3
|
+
��vS}�
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
YoFhlyUEi7VLlqNH0H/JFttVZK6+qmLelkVNcIYVLeWOB4Lf4VxEiYGEK1ORxsrY
|
30
30
|
iyYKJJALWY1FAInGRIlvkN+B8o3yIhq1
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2021-
|
32
|
+
date: 2021-05-08 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activemodel
|
@@ -927,6 +927,7 @@ files:
|
|
927
927
|
- spec/rails/controller_extension/controller_runtime_spec.rb
|
928
928
|
- spec/rails/mongoid_spec.rb
|
929
929
|
- spec/shared/LICENSE
|
930
|
+
- spec/shared/bin/get-mongodb-download-url
|
930
931
|
- spec/shared/lib/mrss/child_process_helper.rb
|
931
932
|
- spec/shared/lib/mrss/cluster_config.rb
|
932
933
|
- spec/shared/lib/mrss/constraints.rb
|
@@ -934,18 +935,17 @@ files:
|
|
934
935
|
- spec/shared/lib/mrss/lite_constraints.rb
|
935
936
|
- spec/shared/lib/mrss/server_version_registry.rb
|
936
937
|
- spec/shared/lib/mrss/spec_organizer.rb
|
938
|
+
- spec/shared/lib/mrss/utils.rb
|
937
939
|
- spec/shared/share/Dockerfile.erb
|
938
940
|
- spec/shared/shlib/distro.sh
|
939
941
|
- spec/shared/shlib/server.sh
|
940
942
|
- spec/shared/shlib/set_env.sh
|
941
943
|
- spec/spec_helper.rb
|
942
944
|
- spec/support/authorization.rb
|
943
|
-
- spec/support/child_process_helper.rb
|
944
945
|
- spec/support/cluster_config.rb
|
945
946
|
- spec/support/constraints.rb
|
946
947
|
- spec/support/expectations.rb
|
947
948
|
- spec/support/helpers.rb
|
948
|
-
- spec/support/lite_constraints.rb
|
949
949
|
- spec/support/macros.rb
|
950
950
|
- spec/support/session_registry.rb
|
951
951
|
- spec/support/shared/time.rb
|
@@ -1270,11 +1270,13 @@ test_files:
|
|
1270
1270
|
- spec/shared/lib/mrss/constraints.rb
|
1271
1271
|
- spec/shared/lib/mrss/server_version_registry.rb
|
1272
1272
|
- spec/shared/lib/mrss/docker_runner.rb
|
1273
|
+
- spec/shared/lib/mrss/utils.rb
|
1273
1274
|
- spec/shared/lib/mrss/cluster_config.rb
|
1274
1275
|
- spec/shared/lib/mrss/lite_constraints.rb
|
1275
1276
|
- spec/shared/lib/mrss/child_process_helper.rb
|
1276
1277
|
- spec/shared/lib/mrss/spec_organizer.rb
|
1277
1278
|
- spec/shared/LICENSE
|
1279
|
+
- spec/shared/bin/get-mongodb-download-url
|
1278
1280
|
- spec/shared/share/Dockerfile.erb
|
1279
1281
|
- spec/README.md
|
1280
1282
|
- spec/lite_spec_helper.rb
|
@@ -1286,9 +1288,7 @@ test_files:
|
|
1286
1288
|
- spec/support/expectations.rb
|
1287
1289
|
- spec/support/constraints.rb
|
1288
1290
|
- spec/support/cluster_config.rb
|
1289
|
-
- spec/support/lite_constraints.rb
|
1290
1291
|
- spec/support/spec_config.rb
|
1291
|
-
- spec/support/child_process_helper.rb
|
1292
1292
|
- spec/app/models/contextable_item.rb
|
1293
1293
|
- spec/app/models/alert.rb
|
1294
1294
|
- spec/app/models/dragon.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,76 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
autoload :ChildProcess, 'childprocess'
|
5
|
-
autoload :Tempfile, 'tempfile'
|
6
|
-
|
7
|
-
module ChildProcessHelper
|
8
|
-
module_function def call(cmd, env: nil, cwd: nil)
|
9
|
-
process = ChildProcess.new(*cmd)
|
10
|
-
process.io.inherit!
|
11
|
-
if cwd
|
12
|
-
process.cwd = cwd
|
13
|
-
end
|
14
|
-
if env
|
15
|
-
env.each do |k, v|
|
16
|
-
process.environment[k.to_s] = v
|
17
|
-
end
|
18
|
-
end
|
19
|
-
process.start
|
20
|
-
process.wait
|
21
|
-
process
|
22
|
-
end
|
23
|
-
|
24
|
-
module_function def check_call(cmd, env: nil, cwd: nil)
|
25
|
-
process = call(cmd, env: env, cwd: cwd)
|
26
|
-
unless process.exit_code == 0
|
27
|
-
raise "Failed to execute: #{cmd}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
module_function def get_output(cmd, env: nil, cwd: nil)
|
32
|
-
process = ChildProcess.new(*cmd)
|
33
|
-
process.io.inherit!
|
34
|
-
if cwd
|
35
|
-
process.cwd = cwd
|
36
|
-
end
|
37
|
-
if env
|
38
|
-
env.each do |k, v|
|
39
|
-
process.environment[k.to_s] = v
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
output = ''
|
44
|
-
r, w = IO.pipe
|
45
|
-
|
46
|
-
begin
|
47
|
-
process.io.stdout = w
|
48
|
-
process.start
|
49
|
-
w.close
|
50
|
-
|
51
|
-
thread = Thread.new do
|
52
|
-
begin
|
53
|
-
loop do
|
54
|
-
output << r.readpartial(16384)
|
55
|
-
end
|
56
|
-
rescue EOFError
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
process.wait
|
61
|
-
thread.join
|
62
|
-
ensure
|
63
|
-
r.close
|
64
|
-
end
|
65
|
-
|
66
|
-
[process, output]
|
67
|
-
end
|
68
|
-
|
69
|
-
module_function def check_output(*args)
|
70
|
-
process, output = get_output(*args)
|
71
|
-
unless process.exit_code == 0
|
72
|
-
raise "Failed to execute: #{args}"
|
73
|
-
end
|
74
|
-
output
|
75
|
-
end
|
76
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module LiteConstraints
|
2
|
-
# Constrain tests that use TimeoutInterrupt to MRI (and Unix)
|
3
|
-
def only_mri
|
4
|
-
before do
|
5
|
-
unless SpecConfig.instance.mri?
|
6
|
-
skip "MRI required, we have #{SpecConfig.instance.platform}"
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
# This is for marking tests that fail on jruby that should
|
12
|
-
# in principle work (as opposed to being fundamentally incompatible
|
13
|
-
# with jruby).
|
14
|
-
# Often times these failures happen only in Evergreen.
|
15
|
-
def fails_on_jruby
|
16
|
-
before do
|
17
|
-
unless SpecConfig.instance.mri?
|
18
|
-
skip "Fails on jruby"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|