Skip to content

Commit d2e7245

Browse files
committed
Remove serverless logic in test runners
1 parent 7287253 commit d2e7245

File tree

4 files changed

+6
-42
lines changed

4 files changed

+6
-42
lines changed

tests/FunctionalTestCase.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -420,16 +420,6 @@ protected function isStandalone()
420420
return $this->getPrimaryServer()->getType() == Server::TYPE_STANDALONE;
421421
}
422422

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-
433423
protected function isShardedCluster()
434424
{
435425
$type = $this->getPrimaryServer()->getType();

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/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/UnifiedTestRunner.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function __construct(private string $internalClientUri)
8787
*
8888
* Atlas Data Lake also does not support killAllSessions.
8989
*/
90-
if ($this->isServerless() || FunctionalTestCase::isAtlas($internalClientUri) || $this->isAtlasDataLake()) {
90+
if (FunctionalTestCase::isAtlas($internalClientUri) || $this->isAtlasDataLake()) {
9191
$this->allowKillAllSessions = false;
9292
}
9393

@@ -247,7 +247,6 @@ private function checkRunOnRequirements(array $runOnRequirements): void
247247
$this->getTopology(),
248248
$this->serverParameterHelper,
249249
$this->isAuthenticated(),
250-
$this->isServerless(),
251250
$this->isClientSideEncryptionSupported(),
252251
];
253252
}
@@ -316,10 +315,6 @@ private function isAtlasDataLake(): bool
316315

317316
/**
318317
* 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.
323318
*/
324319
private function isAuthenticated(): bool
325320
{
@@ -353,16 +348,6 @@ private function isClientSideEncryptionSupported(): bool
353348
return FunctionalTestCase::isCryptSharedLibAvailable() || FunctionalTestCase::isMongocryptdAvailable();
354349
}
355350

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-
366351
/**
367352
* Checks is a test format schema version is supported.
368353
*/
@@ -530,7 +515,7 @@ private function createContext(): Context
530515
$context->setUrisForUseMultipleMongoses($singleMongosUri, $multiMongosUri);
531516
}
532517

533-
if ($this->getPrimaryServer()->getType() === Server::TYPE_LOAD_BALANCER && ! $this->isServerless()) {
518+
if ($this->getPrimaryServer()->getType() === Server::TYPE_LOAD_BALANCER) {
534519
$singleMongosUri = getenv('MONGODB_SINGLE_MONGOS_LB_URI');
535520
$multiMongosUri = getenv('MONGODB_MULTI_MONGOS_LB_URI');
536521

0 commit comments

Comments
 (0)