From a42f990fc910b9713533446f0801d85ded6342be Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 2 Dec 2021 18:31:51 +0100 Subject: [PATCH] fixup: make csfle integration work --- .evergreen/run-custom-csfle-tests.sh | 6 ++++-- test/tools/runner/config.js | 26 ++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.evergreen/run-custom-csfle-tests.sh b/.evergreen/run-custom-csfle-tests.sh index 1b3e6fc0a58..0d9d4a22916 100644 --- a/.evergreen/run-custom-csfle-tests.sh +++ b/.evergreen/run-custom-csfle-tests.sh @@ -36,10 +36,12 @@ pushd ../csfle-deps-tmp rm -rf libmongocrypt mongo-c-driver -git clone https://github.com/mongodb/libmongocrypt.git +#git clone https://github.com/mongodb/libmongocrypt.git +git clone https://github.com/mongodb-js/libmongocrypt.git pushd libmongocrypt git fetch --tags -git checkout "$CSFLE_GIT_REF" -b csfle-custom +#git checkout "$CSFLE_GIT_REF" -b csfle-custom +git checkout "ea3f6252b55cf235e8adf3a04930479d6e5ed11f" -b csfle-custom popd # libmongocrypt git clone https://github.com/mongodb/mongo-c-driver.git diff --git a/test/tools/runner/config.js b/test/tools/runner/config.js index fd7f8337bcc..8f496307f89 100644 --- a/test/tools/runner/config.js +++ b/test/tools/runner/config.js @@ -53,7 +53,13 @@ class TestConfiguration { host: hostAddresses[0].host, port: typeof hostAddresses[0].host === 'string' ? hostAddresses[0].port : undefined, db: url.pathname.slice(1) ? url.pathname.slice(1) : 'integration_tests', - replicaSet: url.searchParams.get('replicaSet') + replicaSet: url.searchParams.get('replicaSet'), + proxyURIParams: url.searchParams.get('proxyHost') ? { + proxyHost: url.searchParams.get('proxyHost'), + proxyPort: url.searchParams.get('proxyPort'), + proxyUsername: url.searchParams.get('proxyUsername'), + proxyPassword: url.searchParams.get('proxyPassword') + } : undefined }; if (url.username) { this.options.auth = { @@ -144,6 +150,14 @@ class TestConfiguration { Object.assign(dbOptions, { replicaSet: this.options.replicaSet }); } + if (this.options.proxyURIParams) { + for (const [ name, value ] of Object.entries(this.options.proxyURIParams)) { + if (value) { + dbOptions[name] = value; + } + } + } + // Flatten any options nested under `writeConcern` before we make the connection string if (dbOptions.writeConcern) { Object.assign(dbOptions, dbOptions.writeConcern); @@ -206,7 +220,7 @@ class TestConfiguration { * @param {UrlOptions} [options] - overrides and settings for URI generation */ url(options) { - options = { db: this.options.db, replicaSet: this.options.replicaSet, ...options }; + options = { db: this.options.db, replicaSet: this.options.replicaSet, proxyURIParams: this.options.proxyURIParams, ...options }; const FILLER_HOST = 'fillerHost'; @@ -216,6 +230,14 @@ class TestConfiguration { url.searchParams.append('replicaSet', options.replicaSet); } + if (options.proxyURIParams) { + for (const [ name, value ] of Object.entries(options.proxyURIParams)) { + if (value) { + url.searchParams.append(name, value); + } + } + } + url.pathname = `/${options.db}`; if (options.username) url.username = options.username;