Skip to content

Commit 33a6bc5

Browse files
p-mongop
andcommitted
RUBY-2947 MONGOID-5216 partial cherry-pick: Update Mongoid test tooling for driver/MRSS 5.2/6.0 changes + partial work on app tests fixes (#5132)
* MONGOID-5216 reinstate app tests * retry node installs * update test-apps to remove bootsnap * debug * remove debug * speed up tests * use newer node in evergreen * update mrss * use python3 * do not load ruby-debug-ide in docker, same is driver * update mrss * use python3 * Make app tests default to ubuntu2004, make them work on this distro * use ubuntu instead of rhel * python env setup from driver * test 4.x server on ubuntu1804 * use node 12 in evergreen * update mrss * update * update mrss Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent dfe8462 commit 33a6bc5

File tree

4 files changed

+37
-30
lines changed

4 files changed

+37
-30
lines changed

.evergreen/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ buildvariants:
648648
topology: ['replica-set', 'sharded-cluster']
649649
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
650650
run_on:
651-
- rhel80-small
651+
- ubuntu2004-small
652652
tasks:
653653
- name: "test"
654654

@@ -660,7 +660,7 @@ buildvariants:
660660
topology: ['replica-set', 'sharded-cluster']
661661
display_name: "${ruby}, ${driver}, ${mongodb-version}, ${topology}"
662662
run_on:
663-
- rhel70-small
663+
- ubuntu1804-small
664664
tasks:
665665
- name: "test"
666666

@@ -685,7 +685,7 @@ buildvariants:
685685
rails: ['7.0']
686686
display_name: "${rails}, ${driver}, ${mongodb-version}"
687687
run_on:
688-
- rhel70-small
688+
- ubuntu2004-small
689689
tasks:
690690
- name: "test"
691691

@@ -698,7 +698,7 @@ buildvariants:
698698
rails: ['6.0', '6.1']
699699
display_name: "${rails}, ${driver}, ${mongodb-version}"
700700
run_on:
701-
- rhel80-small
701+
- ubuntu2004-small
702702
tasks:
703703
- name: "test"
704704

@@ -711,7 +711,7 @@ buildvariants:
711711
rails: ['5.1', '5.2']
712712
display_name: "${rails}, ${driver}, ${mongodb-version}"
713713
run_on:
714-
- rhel70-small
714+
- ubuntu1804-small
715715
tasks:
716716
- name: "test"
717717

@@ -724,7 +724,7 @@ buildvariants:
724724
i18n: '1.0'
725725
display_name: "i18n-1.0 ${rails}, ${driver}, ${mongodb-version}"
726726
run_on:
727-
- rhel70-small
727+
- ubuntu1804-small
728728
tasks:
729729
- name: "test"
730730

@@ -738,7 +738,7 @@ buildvariants:
738738
test-i18n-fallbacks: yes
739739
display_name: "i18n fallbacks ${rails}, ${driver}, ${mongodb-version}, ${i18n}"
740740
run_on:
741-
- rhel70-small
741+
- ubuntu1804-small
742742
tasks:
743743
- name: "test"
744744

.evergreen/run-tests.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ arch=`host_distro`
1717

1818
set_fcv
1919
set_env_vars
20+
set_env_python
21+
set_env_node
2022
set_env_ruby
2123

24+
if test -n "$APP_TESTS"; then
25+
# Node from toolchain
26+
export PATH=/opt/node/bin:$PATH
27+
node -v
28+
fi
29+
2230
prepare_server $arch
2331

2432
install_mlaunch_virtualenv
@@ -34,13 +42,6 @@ launch_server "$dbdir"
3442

3543
uri_options="$URI_OPTIONS"
3644

37-
# This is needed because of ruby 3.0.0.
38-
# We should remove this when moving to 3.0.1
39-
# See https://jira.mongodb.org/browse/MONGOID-5115
40-
if test "$RVM_RUBY" = "ruby-3.0"; then
41-
gem update --system
42-
fi
43-
4445
which bundle
4546
bundle --version
4647

@@ -118,6 +119,6 @@ if test -f tmp/rspec-all.json; then
118119
mv tmp/rspec-all.json tmp/rspec.json
119120
fi
120121

121-
python2 -m mtools.mlaunch.mlaunch stop --dir "$dbdir"
122+
python3 -m mtools.mlaunch.mlaunch stop --dir "$dbdir"
122123

123124
exit ${test_status}

gemfiles/standard.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def standard_dependencies
66

77
platform :mri do
88
# Debugger for VSCode.
9-
if !ENV['CI'] && RUBY_VERSION < '3.0'
9+
if !ENV['CI'] && !ENV['DOCKER'] && RUBY_VERSION < '3.0'
1010
gem 'debase'
1111
gem 'ruby-debug-ide'
1212
end

spec/integration/app_spec.rb

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
BASE = File.join(File.dirname(__FILE__), '../..')
66
TMP_BASE = File.join(BASE, 'tmp')
77

8+
def check_call(cmd, **opts)
9+
puts "Executing #{cmd.join(' ')}"
10+
Mrss::ChildProcessHelper.check_call(cmd, **opts)
11+
end
12+
813
describe 'Mongoid application tests' do
914
before(:all) do
1015
unless SpecConfig.instance.app_tests?
@@ -87,14 +92,14 @@ def start_app(cmd, port, timeout)
8792

8893
Dir.chdir(TMP_BASE) do
8994
FileUtils.rm_rf('mongoid-test')
90-
Mrss::ChildProcessHelper.check_call(%w(rails new mongoid-test --skip-spring --skip-active-record), env: clean_env)
95+
check_call(%w(rails new mongoid-test --skip-spring --skip-active-record), env: clean_env)
9196

9297
Dir.chdir('mongoid-test') do
9398
adjust_app_gemfile
94-
Mrss::ChildProcessHelper.check_call(%w(bundle install), env: clean_env)
99+
check_call(%w(bundle install), env: clean_env)
95100

96-
Mrss::ChildProcessHelper.check_call(%w(rails g model post), env: clean_env)
97-
Mrss::ChildProcessHelper.check_call(%w(rails g model comment post:belongs_to), env: clean_env)
101+
check_call(%w(rails g model post), env: clean_env)
102+
check_call(%w(rails g model comment post:belongs_to), env: clean_env)
98103

99104
# https://jira.mongodb.org/browse/MONGOID-4885
100105
comment_text = File.read('app/models/comment.rb')
@@ -109,16 +114,16 @@ def start_app(cmd, port, timeout)
109114

110115
Dir.chdir(TMP_BASE) do
111116
FileUtils.rm_rf('mongoid-test-config')
112-
Mrss::ChildProcessHelper.check_call(%w(rails new mongoid-test-config --skip-spring --skip-active-record), env: clean_env)
117+
check_call(%w(rails new mongoid-test-config --skip-spring --skip-active-record), env: clean_env)
113118

114119
Dir.chdir('mongoid-test-config') do
115120
adjust_app_gemfile
116-
Mrss::ChildProcessHelper.check_call(%w(bundle install), env: clean_env)
121+
check_call(%w(bundle install), env: clean_env)
117122

118123
mongoid_config_file = File.join(TMP_BASE,'mongoid-test-config/config/mongoid.yml')
119124

120125
File.exist?(mongoid_config_file).should be false
121-
Mrss::ChildProcessHelper.check_call(%w(rails g mongoid:config), env: clean_env)
126+
check_call(%w(rails g mongoid:config), env: clean_env)
122127
File.exist?(mongoid_config_file).should be true
123128

124129
config_text = File.read(mongoid_config_file)
@@ -130,10 +135,11 @@ def start_app(cmd, port, timeout)
130135
end
131136

132137
def install_rails
133-
Mrss::ChildProcessHelper.check_call(%w(gem uni rails -a))
138+
check_call(%w(gem uni rails -a))
134139
if (rails_version = SpecConfig.instance.rails_version) == 'master'
135140
else
136-
Mrss::ChildProcessHelper.check_call(%w(gem install rails --no-document -v) + [rails_version])
141+
check_call(%w(gem list))
142+
check_call(%w(gem install rails --no-document -v) + ["~> #{rails_version}.0"])
137143
end
138144
end
139145

@@ -157,7 +163,7 @@ def install_rails
157163
before do
158164
Dir.chdir(APP_PATH) do
159165
remove_bundler_req
160-
Mrss::ChildProcessHelper.check_call(%w(bundle install), env: env)
166+
check_call(%w(bundle install), env: env)
161167
write_mongoid_yml
162168
end
163169

@@ -171,7 +177,7 @@ def install_rails
171177
end
172178
index.should be nil
173179

174-
Mrss::ChildProcessHelper.check_call(%w(bundle exec rake db:mongoid:create_indexes),
180+
check_call(%w(bundle exec rake db:mongoid:create_indexes -t),
175181
cwd: APP_PATH, env: env)
176182

177183
index = client['posts'].indexes.detect do |index|
@@ -189,11 +195,11 @@ def install_rails
189195
def clone_application(repo_url, subdir: nil)
190196
Dir.chdir(TMP_BASE) do
191197
FileUtils.rm_rf(File.basename(repo_url))
192-
Mrss::ChildProcessHelper.check_call(%w(git clone) + [repo_url])
198+
check_call(%w(git clone) + [repo_url])
193199
Dir.chdir(File.join(*[File.basename(repo_url), subdir].compact)) do
194200
adjust_app_gemfile
195201
adjust_rails_defaults
196-
Mrss::ChildProcessHelper.check_call(%w(bundle install), env: clean_env)
202+
check_call(%w(bundle install), env: clean_env)
197203
puts `git diff`
198204

199205
write_mongoid_yml
@@ -316,7 +322,7 @@ def remove_spring
316322
# in `initialize': too long unix socket path (126bytes given but 108bytes max) (ArgumentError)
317323
# Is it trying to create unix sockets in current directory?
318324
# https://stackoverflow.com/questions/30302021/rails-runner-without-spring
319-
Mrss::ChildProcessHelper.check_call(%w(bin/spring binstub --remove --all), env: clean_env)
325+
check_call(%w(bin/spring binstub --remove --all), env: clean_env)
320326
end
321327

322328
def clean_env

0 commit comments

Comments
 (0)