Skip to content

Commit 922a362

Browse files
p-mongop
andcommitted
RUBY-2059 Depend on bson 4.4.2 for the benefit of driver 2.10 (#1617)
Co-authored-by: Oleg Pudeyev <p@users.noreply.github.com>
1 parent 2241796 commit 922a362

File tree

15 files changed

+222
-69
lines changed

15 files changed

+222
-69
lines changed

.evergreen/config.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ axes:
545545
display_name: "2.6"
546546
variables:
547547
VERSION: "2.6"
548+
548549
- id: fcv
549550
display_name: FCV
550551
values:
@@ -568,6 +569,7 @@ axes:
568569
display_name: Sharded
569570
variables:
570571
TOPOLOGY: "sharded_cluster"
572+
571573
- id: "auth-and-ssl"
572574
display_name: Authentication and SSL
573575
values:
@@ -591,6 +593,7 @@ axes:
591593
variables:
592594
AUTH: "noauth"
593595
SSL: "nossl"
596+
594597
- id: "ruby"
595598
display_name: Ruby Version
596599
values:
@@ -638,6 +641,7 @@ axes:
638641
display_name: jruby-9.2
639642
variables:
640643
RVM_RUBY: "jruby-9.2"
644+
641645
- id: "os"
642646
display_name: OS
643647
values:
@@ -652,48 +656,67 @@ axes:
652656
- id: rhel70
653657
display_name: "RHEL 7.0"
654658
run_on: rhel70-small
659+
655660
- id: "compressor"
656661
display_name: Compressor
657662
values:
658663
- id: "zlib"
659664
display_name: Zlib
660665
variables:
661666
COMPRESSOR: "zlib"
667+
662668
- id: retry-reads
663669
display_name: Retry Reads
664670
values:
665671
- id: no-retry-reads
666672
display_name: No Retry Reads
667673
variables:
668674
RETRY_READS: 'false'
675+
669676
- id: retry-writes
670677
display_name: Retry Writes
671678
values:
672679
- id: no-retry-writes
673680
display_name: No Retry Writes
674681
variables:
675682
RETRY_WRITES: 'false'
683+
676684
- id: lint
677685
display_name: Lint
678686
values:
679687
- id: on
680688
display_name: On
681689
variables:
682690
LINT: '1'
691+
683692
- id: "as"
684693
display_name: ActiveSupport
685694
values:
686695
- id: "as"
687696
display_name: AS
688697
variables:
689698
WITH_ACTIVE_SUPPORT: true
699+
700+
- id: bson
701+
display_name: BSON
702+
values:
703+
- id: min
704+
display_name: min
705+
variables:
706+
BSON: min
707+
- id: master
708+
display_name: master
709+
variables:
710+
BSON: master
711+
690712
- id: "single-mongos"
691713
display_name: Single Mongos
692714
values:
693715
- id: "single-mongos"
694716
display_name: Single Mongos
695717
variables:
696718
SINGLE_MONGOS: 'true'
719+
697720
- id: storage-engine
698721
display_name: Storage Engine
699722
values:
@@ -903,6 +926,17 @@ buildvariants:
903926
tasks:
904927
- name: "test"
905928

929+
- matrix_name: "bson"
930+
matrix_spec:
931+
ruby: ruby-2.6
932+
mongodb-version: '4.2'
933+
topology: replica-set
934+
bson: "*"
935+
os: rhel70
936+
display_name: "AS ${mongodb-version} ${topology} ${ruby} ${bson}"
937+
tasks:
938+
- name: "test"
939+
906940
-
907941
matrix_name: "3.6-with-3.4-fcv"
908942
matrix_spec:

.evergreen/functions.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ set_env_vars() {
5858
fi
5959
export CI=evergreen
6060
# JRUBY_OPTS were initially set for Mongoid
61-
export JRUBY_OPTS="--server -J-Xms512m -J-Xmx1G"
61+
export JRUBY_OPTS="--server -J-Xms512m -J-Xmx2G"
62+
63+
if test "$BSON" = min; then
64+
export BUNDLE_GEMFILE=gemfiles/bson_min.gemfile
65+
elif test "$BSON" = master; then
66+
export BUNDLE_GEMFILE=gemfiles/bson_master.gemfile
67+
fi
6268
}
6369

6470
setup_ruby() {

Gemfile

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,7 @@
11
source 'https://rubygems.org'
22

33
gemspec
4-
gem 'yard'
54

6-
group :development, :testing do
7-
gem 'jruby-openssl', platforms: :jruby
8-
gem 'json', platforms: :jruby
9-
# Explicitly specify each rspec dependency so that we can use
10-
# rspec-mocks-diag instead of rspec-mocks
11-
#gem 'rspec', '~> 3.0'
12-
gem 'rspec-core', '~> 3.0'
13-
gem 'mime-types', '~> 1.25'
14-
if RUBY_VERSION >= '2.3'
15-
gem 'activesupport'
16-
end
17-
if RUBY_VERSION < '2.0.0'
18-
gem 'rake', '~> 12.2.0'
19-
gem 'httparty', '0.14.0'
20-
else
21-
gem 'rake'
22-
gem 'httparty'
23-
end
24-
25-
if RUBY_VERSION >= '2.3'
26-
gem 'byebug', platforms: :mri
27-
elsif RUBY_VERSION >= '2.0'
28-
gem 'byebug', '< 11', platforms: :mri
29-
end
30-
31-
# for benchmark tests
32-
gem 'yajl-ruby', require: 'yajl', platforms: :mri
33-
gem 'celluloid', platforms: :mri, require: false
34-
if RUBY_VERSION < '2.2'
35-
gem 'timers', '< 4.2'
36-
gem 'hitimes', '1.3.0'
37-
else
38-
gem 'timers'
39-
end
40-
end
5+
require_relative './gemfiles/standard'
416

42-
group :testing do
43-
gem 'timecop'
44-
gem 'ice_nine'
45-
gem 'rspec-retry'
46-
if RUBY_VERSION >= '2.3'
47-
gem 'rspec-expectations', '~> 3.0'
48-
gem 'rspec-mocks-diag', '~> 3.0'
49-
end
50-
gem 'rfc'
51-
gem 'fuubar'
52-
gem 'timeout-interrupt', platforms: :mri
53-
54-
if RUBY_VERSION < '2.3'
55-
gem 'ffi', '<1.11'
56-
end
57-
end
58-
59-
group :development do
60-
gem 'ruby-prof', :platforms => :mri
61-
gem 'pry-rescue'
62-
gem 'pry-nav'
63-
end
7+
standard_dependencies

gemfiles/bson_master.gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
gemspec path: '..'
3+
4+
gem 'bson', git: 'https://github.com/mongodb/bson-ruby'
5+
6+
require_relative './standard'
7+
8+
standard_dependencies

gemfiles/bson_min.gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source "https://rubygems.org"
2+
gemspec path: '..'
3+
4+
gem 'bson', '4.4.2'
5+
6+
require_relative './standard'
7+
8+
standard_dependencies

gemfiles/standard.rb

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
def standard_dependencies
2+
gem 'yard'
3+
4+
group :development, :testing do
5+
gem 'jruby-openssl', platforms: :jruby
6+
gem 'json', platforms: :jruby
7+
# Explicitly specify each rspec dependency so that we can use
8+
# rspec-mocks-diag instead of rspec-mocks
9+
#gem 'rspec', '~> 3.0'
10+
gem 'rspec-core', '~> 3.0'
11+
gem 'mime-types', '~> 1.25'
12+
if RUBY_VERSION >= '2.3'
13+
gem 'activesupport'
14+
end
15+
if RUBY_VERSION < '2.0.0'
16+
gem 'rake', '~> 12.2.0'
17+
gem 'httparty', '0.14.0'
18+
else
19+
gem 'rake'
20+
gem 'httparty'
21+
end
22+
23+
if RUBY_VERSION >= '2.3'
24+
gem 'byebug', platforms: :mri
25+
elsif RUBY_VERSION >= '2.0'
26+
gem 'byebug', '< 11', platforms: :mri
27+
end
28+
29+
# for benchmark tests
30+
gem 'yajl-ruby', require: 'yajl', platforms: :mri
31+
gem 'celluloid', platforms: :mri, require: false
32+
if RUBY_VERSION < '2.2'
33+
gem 'timers', '< 4.2'
34+
gem 'hitimes', '1.3.0'
35+
else
36+
gem 'timers'
37+
end
38+
end
39+
40+
group :testing do
41+
gem 'timecop'
42+
gem 'ice_nine'
43+
gem 'rspec-retry'
44+
if RUBY_VERSION >= '2.3'
45+
gem 'rspec-expectations', '~> 3.0'
46+
gem 'rspec-mocks-diag', '~> 3.0'
47+
end
48+
gem 'rfc'
49+
gem 'fuubar'
50+
gem 'timeout-interrupt', platforms: :mri
51+
52+
if RUBY_VERSION < '2.3'
53+
gem 'ffi', '<1.11'
54+
end
55+
end
56+
57+
group :development do
58+
gem 'ruby-prof', :platforms => :mri
59+
gem 'pry-rescue'
60+
gem 'pry-nav'
61+
end
62+
end

lib/mongo/cursor/builder/kill_cursors_command.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ def update_cursors(spec, ids)
9292
#
9393
# @since 2.3.0
9494
def get_cursors_list(spec)
95-
spec[:selector][:cursors].map(&:value)
95+
spec[:selector][:cursors].map do |value|
96+
if value.respond_to?(:value)
97+
# bson-ruby >= 4.6.0
98+
value = value.value
99+
else
100+
value = value.instance_variable_get('@integer')
101+
end
102+
end
96103
end
97104
end
98105
end

lib/mongo/cursor/builder/op_kill_cursors.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,14 @@ def update_cursors(spec, ids)
8787
#
8888
# @since 2.3.0
8989
def get_cursors_list(spec)
90-
spec[:cursor_ids].map(&:value)
90+
spec[:cursor_ids].map do |value|
91+
if value.respond_to?(:value)
92+
# bson-ruby >= 4.6.0
93+
value.value
94+
else
95+
value.instance_variable_get('@integer')
96+
end
97+
end
9198
end
9299
end
93100
end

lib/mongo/protocol/serializers.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ module Int32
110110
# @return [String] Buffer with serialized value.
111111
def self.serialize(buffer, value, validating_keys = BSON::Config.validating_keys?)
112112
if value.is_a?(BSON::Int32)
113-
value = value.value
113+
if value.respond_to?(:value)
114+
# bson-ruby >= 4.6.0
115+
value = value.value
116+
else
117+
value = value.instance_variable_get('@integer')
118+
end
114119
end
115120
buffer.put_int32(value)
116121
end
@@ -138,7 +143,12 @@ module Int64
138143
# @return [ String ] Buffer with serialized value.
139144
def self.serialize(buffer, value, validating_keys = BSON::Config.validating_keys?)
140145
if value.is_a?(BSON::Int64)
141-
value = value.value
146+
if value.respond_to?(:value)
147+
# bson-ruby >= 4.6.0
148+
value = value.value
149+
else
150+
value = value.instance_variable_get('@integer')
151+
end
142152
end
143153
buffer.put_int64(value)
144154
end

mongo.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ Gem::Specification.new do |s|
3232
s.require_paths = ['lib']
3333
s.bindir = 'bin'
3434

35-
s.add_dependency 'bson', '>=4.6.0', '<5.0.0'
35+
s.add_dependency 'bson', '>=4.4.2', '<5.0.0'
3636
end

0 commit comments

Comments
 (0)