From 59d4b60f5316310a2e87d3a926a8e8f29be7f5b5 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 25 Sep 2024 10:17:37 +0200 Subject: [PATCH 1/5] MONGOID-5599 Test on multiple mongoses --- .evergreen/config.yml | 1 - .evergreen/config/axes.yml.erb | 1 - spec/support/expectations.rb | 4 +++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 88355ad8d5..f804a21de8 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -427,7 +427,6 @@ axes: display_name: Sharded Cluster variables: TOPOLOGY: "sharded-cluster" - SINGLE_MONGOS: true - id: "auth" display_name: Authentication diff --git a/.evergreen/config/axes.yml.erb b/.evergreen/config/axes.yml.erb index 15fa4f4870..e654086105 100644 --- a/.evergreen/config/axes.yml.erb +++ b/.evergreen/config/axes.yml.erb @@ -54,7 +54,6 @@ axes: display_name: Sharded Cluster variables: TOPOLOGY: "sharded-cluster" - SINGLE_MONGOS: true - id: "auth" display_name: Authentication diff --git a/spec/support/expectations.rb b/spec/support/expectations.rb index fc6d5254e6..50e31f7725 100644 --- a/spec/support/expectations.rb +++ b/spec/support/expectations.rb @@ -3,7 +3,6 @@ module Mongoid module Expectations - def connection_class if defined?(Mongo::Server::ConnectionBase) Mongo::Server::ConnectionBase @@ -14,6 +13,9 @@ def connection_class end def expect_query(number) + if %i[ sharder load-balanced ].include?(ClusterConfig.instance.topology) && number > 0 + skip 'This spec requires replica set or standalone topology' + end rv = nil RSpec::Mocks.with_temporary_scope do if number > 0 From ee92c9be23a4ac22bb857631b11c85616af42ca2 Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 25 Sep 2024 11:29:11 +0200 Subject: [PATCH 2/5] Export proper MONGODB_URI --- .evergreen/run-tests.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index b48d881f40..0acb91d769 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -93,7 +93,12 @@ fi export BUNDLE_GEMFILE -export MONGODB_URI="mongodb://localhost:27017/?appName=test-suite&$uri_options" +if test "$TOPOLOGY"= "sharded-cluster"; then + # We assume that sharded cluster has two mongoses + export MONGODB_URI="mongodb://localhost:27017,localhost:27018/?appName=test-suite&$uri_options" +else + export MONGODB_URI="mongodb://localhost:27017/?appName=test-suite&$uri_options" +fi set +e if test -n "$TEST_CMD"; then From 16c62ab8e7bc81c5dfc148ba56daf7ab8ff4779d Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 25 Sep 2024 11:46:45 +0200 Subject: [PATCH 3/5] Oh my bash --- .evergreen/run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 0acb91d769..ff5f5c1a3f 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -93,7 +93,7 @@ fi export BUNDLE_GEMFILE -if test "$TOPOLOGY"= "sharded-cluster"; then +if test "$TOPOLOGY" = "sharded-cluster"; then # We assume that sharded cluster has two mongoses export MONGODB_URI="mongodb://localhost:27017,localhost:27018/?appName=test-suite&$uri_options" else From 66aeb6df859f7656aa4246a268a2114c76ed099f Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 25 Sep 2024 12:10:21 +0200 Subject: [PATCH 4/5] Fix typo --- spec/support/expectations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/expectations.rb b/spec/support/expectations.rb index 50e31f7725..30084a6a0d 100644 --- a/spec/support/expectations.rb +++ b/spec/support/expectations.rb @@ -13,7 +13,7 @@ def connection_class end def expect_query(number) - if %i[ sharder load-balanced ].include?(ClusterConfig.instance.topology) && number > 0 + if %i[ sharded load-balanced ].include?(ClusterConfig.instance.topology) && number > 0 skip 'This spec requires replica set or standalone topology' end rv = nil From b0427d61d61e7a420fddd96f3c86cd3787e5829b Mon Sep 17 00:00:00 2001 From: Dmitry Rybakov Date: Wed, 25 Sep 2024 12:44:23 +0200 Subject: [PATCH 5/5] Add min server version --- spec/integration/shardable_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/integration/shardable_spec.rb b/spec/integration/shardable_spec.rb index 111083bd48..bfec7baaa7 100644 --- a/spec/integration/shardable_spec.rb +++ b/spec/integration/shardable_spec.rb @@ -6,6 +6,7 @@ describe 'Sharding helpers' do require_topology :sharded + min_server_version '4.4' describe 'shard_collection rake task' do let(:shard_collections) do