Skip to content

Commit 543984d

Browse files
authored
SWIFT-1470 Fix failing load balancer tests (#745)
1 parent 2d45670 commit 543984d

File tree

6 files changed

+8
-53
lines changed

6 files changed

+8
-53
lines changed

.evergreen/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ functions:
110110
SSL=${SSL} \
111111
AUTH=${AUTH} \
112112
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
113+
LOAD_BALANCER=${LOAD_BALANCER} \
113114
sh ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
114115
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
115116
- command: expansions.update
@@ -664,6 +665,7 @@ tasks:
664665
vars:
665666
MONGODB_VERSION: "latest"
666667
TOPOLOGY: "sharded_cluster"
668+
LOAD_BALANCER: "true"
667669
- func: start-load-balancer
668670
- func: "run-lb-tests"
669671
vars:

Sources/CLibMongoC/include/CLibMongoC_mongoc-server-description.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ MONGOC_EXPORT (int32_t)
6666
mongoc_server_description_compressor_id (
6767
const mongoc_server_description_t *description);
6868

69-
/* mongoc_global_mock_service_id is only used for testing. The test runner sets
70-
* this to true when testing against a load balanced deployment to mock the
71-
* presence of a serviceId field in the "hello" response. The purpose of this is
72-
* further described in the Load Balancer test README. */
73-
extern bool mongoc_global_mock_service_id;
74-
7569
BSON_END_DECLS
7670

7771
#endif

Sources/CLibMongoC/mongoc/mongoc-server-description-private.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,10 @@ bool
238238
mongoc_server_description_has_service_id (
239239
const mongoc_server_description_t *description);
240240

241+
/* mongoc_global_mock_service_id is only used for testing. The test runner sets
242+
* this to true when testing against a load balanced deployment to mock the
243+
* presence of a serviceId field in the "hello" response. The purpose of this is
244+
* further described in the Load Balancer test README. */
245+
extern bool mongoc_global_mock_service_id;
246+
241247
#endif

Sources/TestsCommon/CommonTestUtils.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ public enum TestTopologyConfiguration: String, Decodable {
188188
helloReply["isreplicaset"] != true
189189
{
190190
self = .single
191-
// TODO: SWIFT-1319: eventually, we should be able to just check for serviceId here.
192191
} else if MongoSwiftTestCase.topologyType == .loadBalanced {
193192
self = .loadBalanced
194193
} else if helloReply["msg"] == "isdbgrid" {
@@ -712,13 +711,6 @@ extension InsertManyResult {
712711
}
713712
}
714713

715-
// TODO: SWIFT-1319 Remove this method and usages of it.
716-
/// Sets the libmongoc global variable indicating whether to include mock serviceIds in hello responses to the
717-
/// provided value. This is necessary for load balancer testing until SERVER-58500 is complete.
718-
public func setMockServiceId(to value: Bool) {
719-
mongoc_global_mock_service_id = value
720-
}
721-
722714
/// Resolves programmatically provided client options with those specified via environment variables.
723715
public func resolveClientOptions(_ options: MongoClientOptions? = nil) -> MongoClientOptions {
724716
var opts = options ?? MongoClientOptions()
@@ -751,10 +743,5 @@ public func resolveClientOptions(_ options: MongoClientOptions? = nil) -> MongoC
751743
opts.compressors = [.zlib]
752744
}
753745

754-
// TODO: SWIFT-1319 Remove this.
755-
if MongoSwiftTestCase.topologyType == .loadBalanced {
756-
setMockServiceId(to: true)
757-
}
758-
759746
return opts
760747
}

etc/expose-mock-service-id.diff

Lines changed: 0 additions & 32 deletions
This file was deleted.

etc/vendor-libmongoc.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ echo "RENAMING header files"
153153
echo "PATCHING libmongoc"
154154
git apply ${ETC_DIR}/lower-minheartbeatfrequencyms.diff
155155
git apply ${ETC_DIR}/inttypes-non-modular-header-workaround.diff
156-
# TODO SWIFT-1319: Remove.
157-
git apply ${ETC_DIR}/expose-mock-service-id.diff
158156

159157
# Clang modules are build by a conventional structure with an `include` folder for public
160158
# includes, and an umbrella header used as the primary entry point. As part of the vendoring

0 commit comments

Comments
 (0)