Skip to content

Commit bb7cf56

Browse files
p-mongop
authored andcommitted
Fix RUBY-2023 mmap/mlaunch evergreen configurations hardcode server version (#1581)
* Fix RUBY-2023 mmap/mlaunch evergreen configurations hardcode server version * Wait for sessions to work in 3.6 sharded clusters * Try to work around server segfaults * python
1 parent ea15ef7 commit bb7cf56

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed

.evergreen/functions.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ prepare_server() {
186186
version=$2
187187

188188
url=http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-$arch-$version.tgz
189+
prepare_server_from_url $url
190+
}
191+
192+
prepare_server_from_url() {
193+
url=$1
194+
189195
mongodb_dir="$MONGO_ORCHESTRATION_HOME"/mdb
190196
mkdir -p "$mongodb_dir"
191197
curl --retry 3 $url |tar xz -C "$mongodb_dir" -f -

.evergreen/run-tests-mlaunch.sh

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,27 @@ setup_ruby
2323

2424
install_deps
2525

26-
arch=ubuntu1404
27-
version=4.0.9
28-
prepare_server $arch $version
26+
arch=`host_arch`
27+
28+
desired_version=$MONGODB_VERSION
29+
if test -n "$MMAPV1" && test "$desired_version" = 4.0; then
30+
# 4.0.13 segfaults on mmapv1 - https://jira.mongodb.org/browse/SERVER-43079
31+
prepare_server $arch 4.0.9
32+
else
33+
prog=`cat <<-EOT
34+
import urllib, json
35+
url = 'http://downloads.mongodb.org/current.json'
36+
info = json.load(urllib.urlopen(url))
37+
info = [i for i in info['versions'] if i['version'].startswith('$MONGODB_VERSION')][0]
38+
info = [i for i in info['downloads'] if i['archive']['url'].find('enterprise-$arch') > 0][0]
39+
url = info['archive']['url']
40+
print(url)
41+
EOT`
42+
43+
url=`python -c "$prog"`
44+
45+
prepare_server_from_url $url
46+
fi
2947
3048
install_mlaunch
3149
@@ -58,6 +76,12 @@ bundle --version
5876
export MONGODB_URI="mongodb://localhost:27017/?serverSelectionTimeoutMS=30000$uri_options"
5977
bundle exec rake spec:prepare
6078
79+
if test "$TOPOLOGY" = sharded_cluster && test $MONGODB_VERSION = 3.6; then
80+
# On 3.6 server the sessions collection is not immediately available,
81+
# wait for it to spring into existence
82+
bundle exec rake spec:wait_for_sessions
83+
fi
84+
6185
export MONGODB_URI="mongodb://localhost:27017/?appName=test-suite$uri_options"
6286
bundle exec rake spec:ci
6387
test_status=$?

Rakefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,30 @@ namespace :spec do
3434
SpecSetup.new.run
3535
end
3636

37+
desc 'Waits for sessions to be available in the deployment'
38+
task :wait_for_sessions do
39+
$: << File.join(File.dirname(__FILE__), 'spec')
40+
41+
require 'support/utils'
42+
require 'support/spec_config'
43+
require 'support/client_registry'
44+
45+
client = ClientRegistry.instance.global_client('authorized')
46+
client.database.command(ping: 1)
47+
deadline = Time.now + 300
48+
while Time.now < deadline
49+
if client.cluster.send(:sessions_supported?)
50+
break
51+
end
52+
sleep 1
53+
client.close
54+
client.reconnect
55+
end
56+
unless client.cluster.send(:sessions_supported?)
57+
raise "Sessions did not become supported in the allowed time"
58+
end
59+
end
60+
3761
desc 'Prints configuration used by the test suite'
3862
task :config do
3963
$: << File.join(File.dirname(__FILE__), 'spec')

0 commit comments

Comments
 (0)