Skip to content

Commit 451d828

Browse files
Merge branch 'master' into actually-test-rails
2 parents f5e891a + 8eb4727 commit 451d828

File tree

15 files changed

+133
-44
lines changed

15 files changed

+133
-44
lines changed

.evergreen/config.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ functions:
3939
git submodule update --init --recursive
4040
4141
"create expansions":
42-
# Make an evergreen expansion file with dynamic values
42+
# Make an evergreen exapansion file with dynamic values
4343
- command: shell.exec
4444
params:
4545
working_dir: "src"
@@ -427,6 +427,10 @@ axes:
427427
display_name: Sharded Cluster
428428
variables:
429429
TOPOLOGY: "sharded-cluster"
430+
- id: "load-balanced"
431+
display_name: Load Balanced
432+
variables:
433+
TOPOLOGY: "load-balanced"
430434

431435
- id: "auth"
432436
display_name: Authentication
@@ -639,22 +643,22 @@ buildvariants:
639643
tasks:
640644
- name: "test"
641645

642-
- matrix_name: "ruby-3.3"
646+
- matrix_name: "ruby-3.2 + db-7.0"
643647
matrix_spec:
644648
ruby: ["ruby-3.2"]
645649
driver: ["current"]
646-
topology: '*'
650+
topology: ['standalone', 'replica-set', 'sharded-cluster']
647651
mongodb-version: ['7.0']
648652
os: ubuntu-22.04
649653
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
650654
tasks:
651655
- name: "test"
652656

653-
- matrix_name: "ruby-3.2"
657+
- matrix_name: "ruby-3.2 + db-6.0"
654658
matrix_spec:
655659
ruby: ["ruby-3.2"]
656660
driver: ["current"]
657-
topology: '*'
661+
topology: ['standalone', 'replica-set', 'sharded-cluster']
658662
mongodb-version: ['6.0']
659663
os: ubuntu-22.04
660664
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
@@ -665,7 +669,7 @@ buildvariants:
665669
matrix_spec:
666670
ruby: ["ruby-3.1"]
667671
driver: ["current"]
668-
topology: '*'
672+
topology: ['standalone', 'replica-set', 'sharded-cluster']
669673
mongodb-version: ['6.0']
670674
os: ubuntu-22.04
671675
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
@@ -698,7 +702,7 @@ buildvariants:
698702
matrix_spec:
699703
ruby: ["ruby-2.7"]
700704
driver: ["current"]
701-
topology: '*'
705+
topology: ['standalone', 'replica-set', 'sharded-cluster']
702706
mongodb-version: ['4.4']
703707
os: ubuntu-20.04
704708
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"

.evergreen/config/axes.yml.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ axes:
5454
display_name: Sharded Cluster
5555
variables:
5656
TOPOLOGY: "sharded-cluster"
57+
- id: "load-balanced"
58+
display_name: Load Balanced
59+
variables:
60+
TOPOLOGY: "load-balanced"
5761

5862
- id: "auth"
5963
display_name: Authentication

.evergreen/config/commands.yml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ functions:
1313
git submodule update --init --recursive
1414

1515
"create expansions":
16-
# Make an evergreen exapanstion file with dynamic values
16+
# Make an evergreen exapansion file with dynamic values
1717
- command: shell.exec
1818
params:
1919
working_dir: "src"

.evergreen/config/variants.yml.erb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ buildvariants:
1010
tasks:
1111
- name: "test"
1212

13-
- matrix_name: "ruby-3.3"
13+
- matrix_name: "ruby-3.2 + db-7.0"
1414
matrix_spec:
1515
ruby: ["ruby-3.2"]
1616
driver: ["current"]
17-
topology: '*'
17+
topology: ['standalone', 'replica-set', 'sharded-cluster']
1818
mongodb-version: ['7.0']
1919
os: ubuntu-22.04
2020
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
2121
tasks:
2222
- name: "test"
2323

24-
- matrix_name: "ruby-3.2"
24+
- matrix_name: "ruby-3.2 + db-6.0"
2525
matrix_spec:
2626
ruby: ["ruby-3.2"]
2727
driver: ["current"]
28-
topology: '*'
28+
topology: ['standalone', 'replica-set', 'sharded-cluster']
2929
mongodb-version: ['6.0']
3030
os: ubuntu-22.04
3131
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
@@ -36,7 +36,7 @@ buildvariants:
3636
matrix_spec:
3737
ruby: ["ruby-3.1"]
3838
driver: ["current"]
39-
topology: '*'
39+
topology: ['standalone', 'replica-set', 'sharded-cluster']
4040
mongodb-version: ['6.0']
4141
os: ubuntu-22.04
4242
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
@@ -69,7 +69,7 @@ buildvariants:
6969
matrix_spec:
7070
ruby: ["ruby-2.7"]
7171
driver: ["current"]
72-
topology: '*'
72+
topology: ['standalone', 'replica-set', 'sharded-cluster']
7373
mongodb-version: ['4.4']
7474
os: ubuntu-20.04
7575
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"

.evergreen/run-tests.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ set -o errexit # Exit the script with error if any of the commands fail
88
# RVM_RUBY Define the Ruby version to test with, using its RVM identifier.
99
# For example: "ruby-3.0" or "jruby-9.2"
1010

11-
. `dirname "$0"`/../spec/shared/shlib/distro.sh
12-
. `dirname "$0"`/../spec/shared/shlib/set_env.sh
13-
. `dirname "$0"`/../spec/shared/shlib/server.sh
11+
MRSS_ROOT=`dirname "$0"`/../spec/shared
12+
13+
. $MRSS_ROOT/shlib/distro.sh
14+
. $MRSS_ROOT/shlib/set_env.sh
15+
. $MRSS_ROOT/shlib/server.sh
1416
. `dirname "$0"`/functions.sh
1517

1618
arch=`host_distro`
@@ -28,6 +30,10 @@ prepare_server $arch
2830

2931
install_mlaunch_venv
3032

33+
if test "$TOPOLOGY" = load-balanced; then
34+
install_haproxy
35+
fi
36+
3137
# Launching mongod under $MONGO_ORCHESTRATION_HOME
3238
# makes its log available through log collecting machinery
3339

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ if RUBY_PLATFORM =~ /java/
1717
end
1818

1919
gem 'i18n', *i18n_versions
20+
21+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
22+
gem "tzinfo-data", platforms: %i[ windows jruby ]

lib/mongoid/association/embedded/embeds_one/proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def initialize(base, target, association)
3636
bind_one
3737
characterize_one(_target)
3838
update_attributes_hash(_target)
39-
_base._reset_memoized_descendants!
4039
_target.save if persistable?
40+
_base._reset_memoized_descendants!
4141
end
4242
end
4343

lib/mongoid/tasks/database.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def shard_collections(models = ::Mongoid.models)
178178
next
179179
end
180180

181-
unless model.collection.cluster.sharded?
181+
unless model.collection.cluster.sharded? || model.collection.cluster.load_balanced?
182182
logger.warn("MONGOID: #{model} has shard config but is not persisted in a sharded cluster: #{model.collection.cluster.summary}")
183183
next
184184
end

mongoid.gemspec

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ Gem::Specification.new do |s|
2525
'source_code_uri' => 'https://github.com/mongodb/mongoid',
2626
}
2727

28-
if File.exist?('gem-private_key.pem')
29-
s.signing_key = 'gem-private_key.pem'
30-
s.cert_chain = ['gem-public_cert.pem']
31-
else
32-
warn "[#{s.name}] Warning: No private key present, creating unsigned gem."
33-
end
34-
3528
s.required_ruby_version = ">= 2.7"
3629
s.required_rubygems_version = ">= 1.3.6"
3730

spec/integration/associations/embeds_one_spec.rb

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# frozen_string_literal: true
2-
# rubocop:todo all
32

43
require 'spec_helper'
54

65
describe 'embeds_one associations' do
7-
8-
context 're-associating the same object' do
6+
context 'when re-associating the same object' do
97
context 'with dependent: destroy' do
108
let(:canvas) do
119
Canvas.create!(palette: Palette.new)
@@ -17,7 +15,7 @@
1715
canvas.palette = canvas.palette
1816
canvas.save!
1917
canvas.reload
20-
canvas.palette.should == palette
18+
expect(canvas.palette).to eq palette
2119
end
2220
end
2321
end
@@ -31,12 +29,33 @@
3129
end
3230

3331
it 'loads the association correctly' do
34-
expect { klass }.to_not raise_error
35-
expect { klass.new.address }.to_not raise_error
32+
expect { klass }.not_to raise_error
33+
expect { klass.new.address }.not_to raise_error
3634
instance = klass.new
3735
address = Address.new
3836
instance.address = address
3937
expect(instance.address).to eq address
4038
end
4139
end
40+
41+
context 'when parent is persisted' do
42+
let!(:person) do
43+
Person.create!
44+
end
45+
46+
context 'when assigning the new child' do
47+
context 'when assigning an attribute to the child' do
48+
before do
49+
# person.reload
50+
person.name = Name.new
51+
person.name.first_name = 'Dmitry'
52+
person.save!
53+
end
54+
55+
it 'persists the child' do
56+
expect(person.reload.name.first_name).to eq 'Dmitry'
57+
end
58+
end
59+
end
60+
end
4261
end

0 commit comments

Comments
 (0)