Skip to content

Commit 383ff49

Browse files
authored
RUBY-2870 Test driver against bson master and 4-stable (#2406)
* RUBY-2870 add 4-stable gemfile * RUBY-2870 remove extra dependencies * RUBY-2870 change 4-stable to use dashes * RUBY-2870 add environemnt variable for bson master * RUBY-2870 add comment for env var * RUBY-2870 update functions.sh for jruby
1 parent 4897ee4 commit 383ff49

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

.evergreen/config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,11 @@ axes:
756756
display_name: min
757757
variables:
758758
BSON: min
759-
759+
- id: 4-stable
760+
display_name: 4-stable
761+
variables:
762+
BSON: 4-stable
763+
760764
- id: storage-engine
761765
display_name: Storage Engine
762766
values:

.evergreen/functions.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ set_env_vars() {
4343
if test "$BSON" = min; then
4444
export BUNDLE_GEMFILE=gemfiles/bson_min.gemfile
4545
elif test "$BSON" = master; then
46+
export MONGO_RUBY_DRIVER_BSON_MASTER=1
4647
export BUNDLE_GEMFILE=gemfiles/bson_master.gemfile
48+
elif test "$BSON" = 4-stable; then
49+
export BUNDLE_GEMFILE=gemfiles/bson_4-stable.gemfile
4750
elif test "$COMPRESSOR" = snappy; then
4851
export BUNDLE_GEMFILE=gemfiles/snappy_compression.gemfile
4952
elif test "$COMPRESSOR" = zstd; then
@@ -59,17 +62,18 @@ set_env_vars() {
5962
bundle_install() {
6063
args=--quiet
6164

62-
if test "$BSON" = master; then
65+
if test "$BSON" = master || test "$BSON" = 4-stable; then
6366
# In Docker bson is installed in the image, remove it if we need bson master.
6467
gem uni bson || true
6568
fi
6669

6770
# On JRuby we can test against bson master but not in a conventional way.
6871
# See https://jira.mongodb.org/browse/RUBY-2156
69-
if echo $RVM_RUBY |grep -q jruby && test "$BSON" = master; then
72+
if echo $RVM_RUBY |grep -q jruby && (test "$BSON" = master || test "$BSON" = 4-stable); then
7073
unset BUNDLE_GEMFILE
7174
git clone https://github.com/mongodb/bson-ruby
7275
(cd bson-ruby &&
76+
git checkout "origin/$BSON" &&
7377
bundle install &&
7478
rake compile &&
7579
gem build *.gemspec &&

gemfiles/bson_4-stable.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', branch: '4-stable'
5+
6+
require_relative './standard'
7+
8+
standard_dependencies

gemfiles/bson_master.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source "https://rubygems.org"
22
gemspec path: '..'
33

4-
gem 'bson', git: 'https://github.com/mongodb/bson-ruby', branch: '4-stable'
4+
gem 'bson', git: 'https://github.com/mongodb/bson-ruby', branch: 'master'
55

66
require_relative './standard'
77

mongo.gemspec

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Gem::Specification.new do |s|
3737
s.bindir = 'bin'
3838

3939
s.required_ruby_version = ">= 2.5"
40-
41-
s.add_dependency 'bson', '>=4.13.0', '<5.0.0'
40+
41+
# For testing driver against bson master we need to depend on bson < 6.0.0
42+
# but in release version we want to depend on bson < 5.0.0.
43+
if %w(1 yes true).include?(ENV['MONGO_RUBY_DRIVER_BSON_MASTER'])
44+
s.add_dependency 'bson', '>=4.13.0', '<6.0.0'
45+
else
46+
s.add_dependency 'bson', '>=4.13.0', '<5.0.0'
47+
end
4248
end

0 commit comments

Comments
 (0)