Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae3821a

Browse files
authoredJun 4, 2025··
PHPLIB-1667: Remove serverless testing (#1720)
* Remove serverless tasks/functions from evergreen config * Remove serverless logic in test runners * Remove serverless test groups * Remove mentions of serverless from contributing guide * Fix phpcs thingamabobs
1 parent 2c5e6fe commit ae3821a

18 files changed

+7
-213
lines changed
 

‎.evergreen/config/functions.yml

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -172,38 +172,6 @@ functions:
172172
DRIVERS_TOOLS="${DRIVERS_TOOLS}" \
173173
bash ./run-mongohouse-image.sh
174174
175-
"create serverless instance":
176-
- command: subprocess.exec
177-
params:
178-
working_dir: "src"
179-
binary: bash
180-
args:
181-
- ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh
182-
- command: expansions.update
183-
params:
184-
file: src/serverless-expansion.yml
185-
186-
"create serverless proxy instance":
187-
- command: shell.exec
188-
params:
189-
working_dir: "src"
190-
script: |
191-
${PREPARE_SHELL}
192-
193-
VAULT_NAME=serverless_next \
194-
bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh
195-
- command: expansions.update
196-
params:
197-
file: src/serverless-expansion.yml
198-
199-
"delete serverless instance":
200-
- command: subprocess.exec
201-
params:
202-
working_dir: "src"
203-
binary: bash
204-
args:
205-
- ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh
206-
207175
"run tests":
208176
- command: shell.exec
209177
type: test
@@ -252,42 +220,6 @@ functions:
252220
TESTS="atlas-data-lake" \
253221
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
254222
255-
"run serverless tests":
256-
- command: shell.exec
257-
type: test
258-
params:
259-
working_dir: "src"
260-
script: |
261-
${PREPARE_SHELL}
262-
export AWS_ACCESS_KEY_ID="${client_side_encryption_aws_access_key_id}"
263-
export AWS_SECRET_ACCESS_KEY="${client_side_encryption_aws_secret_access_key}"
264-
export AWS_TEMP_ACCESS_KEY_ID="${client_side_encryption_aws_temp_access_key_id}"
265-
export AWS_TEMP_SECRET_ACCESS_KEY="${client_side_encryption_aws_temp_secret_access_key_key}"
266-
export AWS_TEMP_SESSION_TOKEN="${client_side_encryption_aws_temp_session_token}"
267-
export AZURE_TENANT_ID="${client_side_encryption_azure_tenant_id}"
268-
export AZURE_CLIENT_ID="${client_side_encryption_azure_client_id}"
269-
export AZURE_CLIENT_SECRET="${client_side_encryption_azure_client_secret}"
270-
export GCP_EMAIL="${client_side_encryption_gcp_email}"
271-
export GCP_PRIVATE_KEY="${client_side_encryption_gcp_privatekey}"
272-
export KMIP_ENDPOINT="${client_side_encryption_kmip_endpoint}"
273-
export KMS_ENDPOINT_EXPIRED="${client_side_encryption_kms_endpoint_expired}"
274-
export KMS_ENDPOINT_WRONG_HOST="${client_side_encryption_kms_endpoint_wrong_host}"
275-
export KMS_ENDPOINT_REQUIRE_CLIENT_CERT="${client_side_encryption_kms_endpoint_require_client_cert}"
276-
export KMS_TLS_CA_FILE="${client_side_encryption_kms_tls_ca_file}"
277-
export KMS_TLS_CERTIFICATE_KEY_FILE="${client_side_encryption_kms_tls_certificate_key_file}"
278-
export MONGODB_IS_SERVERLESS=on
279-
export PATH="${PHP_PATH}/bin:$PATH"
280-
281-
. ${DRIVERS_TOOLS}/.evergreen/serverless/secrets-export.sh
282-
283-
export MONGODB_USERNAME=$SERVERLESS_ATLAS_USER
284-
export MONGODB_PASSWORD=$SERVERLESS_ATLAS_PASSWORD
285-
286-
CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH} \
287-
MONGODB_URI="${SERVERLESS_URI}" \
288-
TESTS="serverless" \
289-
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
290-
291223
"cleanup":
292224
- command: shell.exec
293225
params:

‎.evergreen/config/generated/test-variant/modern-php-full.yml

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.evergreen/config/generated/test-variant/phpc.yml

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.evergreen/config/templates/test-variant/modern-php-full.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
- ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0"
1717
- ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0"
1818
- ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0"
19-
- "test_serverless_task_group"
20-
- "test_serverless_proxy_task_group"
2119
- "test-atlas-data-lake"
2220

2321
# Test MongoDB 5.0 and 6.0

‎.evergreen/config/templates/test-variant/phpc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@
1515
- ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0"
1616
- ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0"
1717
- ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0"
18-
- "test_serverless_task_group"
19-
- "test_serverless_proxy_task_group"
2018
- "test-atlas-data-lake"

‎.evergreen/config/test-task-groups.yml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,3 @@ task_groups:
3737
setup_group_timeout_secs: 1800
3838
tasks:
3939
- test-atlas
40-
41-
- name: test_serverless_task_group
42-
setup_group:
43-
- func: "fetch source"
44-
- func: "prepare resources"
45-
- func: "fix absolute paths"
46-
- func: "install dependencies"
47-
- func: "locate PHP binaries"
48-
- func: "fetch extension"
49-
- func: "install composer"
50-
- func: "create serverless instance"
51-
teardown_group:
52-
- func: "delete serverless instance"
53-
- func: "upload test results"
54-
- func: "cleanup"
55-
setup_group_can_fail_task: true
56-
setup_group_timeout_secs: 1800
57-
tasks:
58-
- test-serverless
59-
60-
- name: test_serverless_proxy_task_group
61-
setup_group:
62-
- func: "fetch source"
63-
- func: "prepare resources"
64-
- func: "fix absolute paths"
65-
- func: "install dependencies"
66-
- func: "locate PHP binaries"
67-
- func: "fetch extension"
68-
- func: "install composer"
69-
- func: "create serverless proxy instance"
70-
teardown_group:
71-
- func: "delete serverless instance"
72-
- func: "upload test results"
73-
- func: "cleanup"
74-
setup_group_can_fail_task: true
75-
setup_group_timeout_secs: 1800
76-
tasks:
77-
- test-serverless-proxy

‎.evergreen/config/test-tasks.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,6 @@ tasks:
77
vars:
88
TESTS: "atlas"
99

10-
- name: "test-serverless"
11-
tags: ["serverless"]
12-
exec_timeout_secs: 10800
13-
commands:
14-
- func: "start kms servers"
15-
- func: "set aws temp creds"
16-
- func: "run serverless tests"
17-
18-
- name: "test-serverless-proxy"
19-
tags: ["serverless"]
20-
exec_timeout_secs: 10800
21-
commands:
22-
- func: "start kms servers"
23-
- func: "set aws temp creds"
24-
- func: "run serverless tests"
25-
2610
- name: "test-atlas-data-lake"
2711
commands:
2812
- command: ec2.assume_role

‎.evergreen/run-tests.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ case "$TESTS" in
102102
php vendor/bin/phpunit $PHPUNIT_OPTS --group versioned-api
103103
;;
104104

105-
serverless)
106-
php vendor/bin/phpunit $PHPUNIT_OPTS --group serverless
107-
;;
108-
109105
*)
110106
php vendor/bin/phpunit $PHPUNIT_OPTS
111107
;;

‎CONTRIBUTING.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ The `phpunit.xml.dist` file is used as the default configuration file for the
3535
test suite. In addition to various PHPUnit options, it defines environment
3636
variables such as `MONGODB_URI` and `MONGODB_DATABASE`. You may customize
3737
this configuration by creating your own `phpunit.xml` file based on the
38-
`phpunit.xml.dist` file we provide. To run the tests in serverless mode, set the
39-
`MONGODB_IS_SERVERLESS` environment variable to `on`.
38+
`phpunit.xml.dist` file we provide.
4039

4140
To run tests against a cluster that requires authentication, either include the
4241
credentials in the connection string (i.e. `MONGODB_URI`) or set the
@@ -66,12 +65,6 @@ The following environment variable is used for [stable API testing](https://gith
6665
which will then be specified as the `serverApi` driver option for clients
6766
created by the test suite.
6867

69-
The following environment variable is used for [serverless testing](https://github.com/mongodb/specifications/blob/master/source/serverless-testing/README.rst):
70-
71-
* `MONGODB_IS_SERVERLESS`: Specify a true boolean string
72-
(see: [`FILTER_VALIDATE_BOOLEAN`](https://www.php.net/manual/en/filter.filters.validate.php))
73-
if `MONGODB_URI` points to a serverless instance. Defaults to false.
74-
7568
The following environment variables are used for [load balancer testing](https://github.com/mongodb/specifications/blob/master/source/load-balancers/tests/README.rst):
7669

7770
* `MONGODB_SINGLE_MONGOS_LB_URI`: Connection string to a load balancer backed

‎tests/FunctionalTestCase.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use function count;
2525
use function current;
2626
use function explode;
27-
use function filter_var;
2827
use function getenv;
2928
use function implode;
3029
use function in_array;
@@ -46,7 +45,6 @@
4645
use function version_compare;
4746

4847
use const DIRECTORY_SEPARATOR;
49-
use const FILTER_VALIDATE_BOOLEAN;
5048
use const INFO_MODULES;
5149
use const PATH_SEPARATOR;
5250

@@ -420,16 +418,6 @@ protected function isStandalone()
420418
return $this->getPrimaryServer()->getType() == Server::TYPE_STANDALONE;
421419
}
422420

423-
/**
424-
* Return whether serverless (i.e. proxy as mongos) is being utilized.
425-
*/
426-
protected static function isServerless(): bool
427-
{
428-
$isServerless = getenv('MONGODB_IS_SERVERLESS');
429-
430-
return $isServerless !== false ? filter_var($isServerless, FILTER_VALIDATE_BOOLEAN) : false;
431-
}
432-
433421
protected function isShardedCluster()
434422
{
435423
$type = $this->getPrimaryServer()->getType();

‎tests/SpecTests/ClientSideEncryption/Prose21_AutomaticDataEncryptionKeysTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
* @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#automatic-data-encryption-keys
2222
*/
2323
#[Group('csfle')]
24-
#[Group('serverless')]
2524
class Prose21_AutomaticDataEncryptionKeysTest extends FunctionalTestCase
2625
{
2726
public const SERVER_ERROR_TYPEMISMATCH = 14;

‎tests/SpecTests/ClientSideEncryption/Prose22_RangeExplicitEncryptionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#22-range-explicit-encryption
3131
*/
3232
#[Group('csfle')]
33-
#[Group('serverless')]
3433
class Prose22_RangeExplicitEncryptionTest extends FunctionalTestCase
3534
{
3635
private ?ClientEncryption $clientEncryption = null;

‎tests/SpecTests/ClientSideEncryptionSpecTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
* @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption
5454
*/
5555
#[Group('csfle')]
56-
#[Group('serverless')]
5756
class ClientSideEncryptionSpecTest extends FunctionalTestCase
5857
{
5958
public const LOCAL_MASTERKEY = 'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk';

‎tests/SpecTests/FunctionalTestCase.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,7 @@ private function isServerlessRequirementSatisfied(?string $serverlessMode): bool
277277
return true;
278278
}
279279

280-
return match ($serverlessMode) {
281-
self::SERVERLESS_ALLOW => true,
282-
self::SERVERLESS_FORBID => ! static::isServerless(),
283-
self::SERVERLESS_REQUIRE => static::isServerless(),
284-
default => throw new UnexpectedValueException(sprintf('Invalid serverless requirement "%s" found.', $serverlessMode)),
285-
};
280+
return $serverlessMode !== self::SERVERLESS_REQUIRE;
286281
}
287282

288283
/**

‎tests/SpecTests/RetryableWrites/Prose3_ReturnOriginalErrorTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
use MongoDB\Driver\Monitoring\CommandSubscriber;
99
use MongoDB\Driver\Monitoring\CommandSucceededEvent;
1010
use MongoDB\Tests\SpecTests\FunctionalTestCase;
11-
use PHPUnit\Framework\Attributes\Group;
1211

1312
/**
1413
* Prose test 3: Return Original Error
1514
*
1615
* @see https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md
1716
*/
18-
#[Group('serverless')]
1917
class Prose3_ReturnOriginalErrorTest extends FunctionalTestCase
2018
{
2119
public const NOT_WRITABLE_PRIMARY = 10107;

‎tests/UnifiedSpecTests/RunOnRequirement.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function __construct(stdClass $o)
104104
}
105105
}
106106

107-
public function isSatisfied(string $serverVersion, string $topology, ServerParameterHelper $serverParameters, bool $isAuthenticated, bool $isServerless, bool $isClientSideEncryptionSupported): bool
107+
public function isSatisfied(string $serverVersion, string $topology, ServerParameterHelper $serverParameters, bool $isAuthenticated, bool $isClientSideEncryptionSupported): bool
108108
{
109109
if (isset($this->minServerVersion) && version_compare($serverVersion, $this->minServerVersion, '<')) {
110110
return false;
@@ -131,14 +131,8 @@ public function isSatisfied(string $serverVersion, string $topology, ServerParam
131131
return false;
132132
}
133133

134-
if (isset($this->serverless)) {
135-
if (! $isServerless && $this->serverless === self::SERVERLESS_REQUIRE) {
136-
return false;
137-
}
138-
139-
if ($isServerless && $this->serverless === self::SERVERLESS_FORBID) {
140-
return false;
141-
}
134+
if (isset($this->serverless) && $this->serverless === self::SERVERLESS_REQUIRE) {
135+
return false;
142136
}
143137

144138
if (isset($this->csfle) && $isClientSideEncryptionSupported !== $this->csfle) {

‎tests/UnifiedSpecTests/UnifiedSpecTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ public static function provideAtlasDataLakeTests(): Generator
131131
}
132132

133133
#[DataProvider('provideChangeStreamsTests')]
134-
#[Group('serverless')]
135134
public function testChangeStreams(UnifiedTestCase $test): void
136135
{
137136
self::$runner->run($test);
@@ -144,7 +143,6 @@ public static function provideChangeStreamsTests(): Generator
144143

145144
#[DataProvider('provideClientSideEncryptionTests')]
146145
#[Group('csfle')]
147-
#[Group('serverless')]
148146
public function testClientSideEncryption(UnifiedTestCase $test): void
149147
{
150148
self::$runner->run($test);
@@ -156,7 +154,6 @@ public static function provideClientSideEncryptionTests(): Generator
156154
}
157155

158156
#[DataProvider('provideCollectionManagementTests')]
159-
#[Group('serverless')]
160157
public function testCollectionManagement(UnifiedTestCase $test): void
161158
{
162159
self::$runner->run($test);
@@ -168,7 +165,6 @@ public static function provideCollectionManagementTests(): Generator
168165
}
169166

170167
#[DataProvider('provideCommandMonitoringTests')]
171-
#[Group('serverless')]
172168
public function testCommandMonitoring(UnifiedTestCase $test): void
173169
{
174170
self::$runner->run($test);
@@ -180,7 +176,6 @@ public static function provideCommandMonitoringTests(): Generator
180176
}
181177

182178
#[DataProvider('provideCrudTests')]
183-
#[Group('serverless')]
184179
public function testCrud(UnifiedTestCase $test): void
185180
{
186181
self::$runner->run($test);
@@ -192,7 +187,6 @@ public static function provideCrudTests(): Generator
192187
}
193188

194189
#[DataProvider('provideGridFSTests')]
195-
#[Group('serverless')]
196190
public function testGridFS(UnifiedTestCase $test): void
197191
{
198192
self::$runner->run($test);
@@ -204,7 +198,6 @@ public static function provideGridFSTests(): Generator
204198
}
205199

206200
#[DataProvider('provideLoadBalancers')]
207-
#[Group('serverless')]
208201
public function testLoadBalancers(UnifiedTestCase $test): void
209202
{
210203
self::$runner->run($test);
@@ -227,7 +220,6 @@ public static function provideReadWriteConcernTests(): Generator
227220
}
228221

229222
#[DataProvider('provideRetryableReadsTests')]
230-
#[Group('serverless')]
231223
public function testRetryableReads(UnifiedTestCase $test): void
232224
{
233225
self::$runner->run($test);
@@ -239,7 +231,6 @@ public static function provideRetryableReadsTests(): Generator
239231
}
240232

241233
#[DataProvider('provideRetryableWritesTests')]
242-
#[Group('serverless')]
243234
public function testRetryableWrites(UnifiedTestCase $test): void
244235
{
245236
self::$runner->run($test);
@@ -251,7 +242,6 @@ public static function provideRetryableWritesTests(): Generator
251242
}
252243

253244
#[DataProvider('provideRunCommandTests')]
254-
#[Group('serverless')]
255245
public function testRunCommand(UnifiedTestCase $test): void
256246
{
257247
self::$runner->run($test);
@@ -263,7 +253,6 @@ public static function provideRunCommandTests(): Generator
263253
}
264254

265255
#[DataProvider('provideSessionsTests')]
266-
#[Group('serverless')]
267256
public function testSessions(UnifiedTestCase $test): void
268257
{
269258
self::$runner->run($test);
@@ -275,7 +264,6 @@ public static function provideSessionsTests(): Generator
275264
}
276265

277266
#[DataProvider('provideTransactionsTests')]
278-
#[Group('serverless')]
279267
public function testTransactions(UnifiedTestCase $test): void
280268
{
281269
self::$runner->run($test);
@@ -298,7 +286,6 @@ public static function provideTransactionsConvenientApiTests(): Generator
298286
}
299287

300288
#[DataProvider('provideVersionedApiTests')]
301-
#[Group('serverless')]
302289
#[Group('versioned-api')]
303290
public function testVersionedApi(UnifiedTestCase $test): void
304291
{

‎tests/UnifiedSpecTests/UnifiedTestRunner.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use function call_user_func;
2121
use function count;
2222
use function explode;
23-
use function filter_var;
2423
use function gc_collect_cycles;
2524
use function getenv;
2625
use function implode;
@@ -41,8 +40,6 @@
4140
use function substr_replace;
4241
use function version_compare;
4342

44-
use const FILTER_VALIDATE_BOOLEAN;
45-
4643
/**
4744
* Unified test runner.
4845
*
@@ -87,7 +84,7 @@ public function __construct(private string $internalClientUri)
8784
*
8885
* Atlas Data Lake also does not support killAllSessions.
8986
*/
90-
if ($this->isServerless() || FunctionalTestCase::isAtlas($internalClientUri) || $this->isAtlasDataLake()) {
87+
if (FunctionalTestCase::isAtlas($internalClientUri) || $this->isAtlasDataLake()) {
9188
$this->allowKillAllSessions = false;
9289
}
9390

@@ -247,7 +244,6 @@ private function checkRunOnRequirements(array $runOnRequirements): void
247244
$this->getTopology(),
248245
$this->serverParameterHelper,
249246
$this->isAuthenticated(),
250-
$this->isServerless(),
251247
$this->isClientSideEncryptionSupported(),
252248
];
253249
}
@@ -316,10 +312,6 @@ private function isAtlasDataLake(): bool
316312

317313
/**
318314
* Return whether the connection is authenticated.
319-
*
320-
* Note: if the connectionStatus command is not portable for serverless, it
321-
* may be necessary to rewrite this to instead inspect the connection string
322-
* or consult an environment variable, as is done in libmongoc.
323315
*/
324316
private function isAuthenticated(): bool
325317
{
@@ -353,16 +345,6 @@ private function isClientSideEncryptionSupported(): bool
353345
return FunctionalTestCase::isCryptSharedLibAvailable() || FunctionalTestCase::isMongocryptdAvailable();
354346
}
355347

356-
/**
357-
* Return whether serverless (i.e. proxy as mongos) is being utilized.
358-
*/
359-
private function isServerless(): bool
360-
{
361-
$isServerless = getenv('MONGODB_IS_SERVERLESS');
362-
363-
return $isServerless !== false ? filter_var($isServerless, FILTER_VALIDATE_BOOLEAN) : false;
364-
}
365-
366348
/**
367349
* Checks is a test format schema version is supported.
368350
*/
@@ -530,7 +512,7 @@ private function createContext(): Context
530512
$context->setUrisForUseMultipleMongoses($singleMongosUri, $multiMongosUri);
531513
}
532514

533-
if ($this->getPrimaryServer()->getType() === Server::TYPE_LOAD_BALANCER && ! $this->isServerless()) {
515+
if ($this->getPrimaryServer()->getType() === Server::TYPE_LOAD_BALANCER) {
534516
$singleMongosUri = getenv('MONGODB_SINGLE_MONGOS_LB_URI');
535517
$multiMongosUri = getenv('MONGODB_MULTI_MONGOS_LB_URI');
536518

0 commit comments

Comments
 (0)
Please sign in to comment.