Skip to content

Commit 1bcb85f

Browse files
authored
PYTHON-5321 Remove Serverless testing (#2359)
1 parent 0dd5a5c commit 1bcb85f

39 files changed

+90
-411
lines changed

.evergreen/generated_configs/tasks.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,16 +3060,6 @@ tasks:
30603060
- sharded_cluster-auth-ssl
30613061
- sync
30623062

3063-
# Serverless tests
3064-
- name: test-serverless
3065-
commands:
3066-
- func: run tests
3067-
vars:
3068-
TEST_NAME: serverless
3069-
AUTH: auth
3070-
SSL: ssl
3071-
tags: [serverless]
3072-
30733063
# Standard tests
30743064
- name: test-standard-v4.0-python3.9-sync-noauth-nossl-standalone
30753065
commands:

.evergreen/generated_configs/variants.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -586,26 +586,6 @@ buildvariants:
586586
- rhel87-small
587587
tags: [coverage_tag]
588588

589-
# Serverless tests
590-
- name: serverless-rhel8-python3.9
591-
tasks:
592-
- name: .serverless
593-
display_name: Serverless RHEL8 Python3.9
594-
run_on:
595-
- rhel87-small
596-
batchtime: 10080
597-
expansions:
598-
PYTHON_BINARY: /opt/python/3.9/bin/python3
599-
- name: serverless-rhel8-python3.13
600-
tasks:
601-
- name: .serverless
602-
display_name: Serverless RHEL8 Python3.13
603-
run_on:
604-
- rhel87-small
605-
batchtime: 10080
606-
expansions:
607-
PYTHON_BINARY: /opt/python/3.13/bin/python3
608-
609589
# Stable api tests
610590
- name: stable-api-require-v1-rhel8-auth
611591
tasks:

.evergreen/scripts/generate_config.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -352,23 +352,6 @@ def create_disable_test_commands_variants():
352352
return [create_variant(tasks, display_name, host=host, python=python, expansions=expansions)]
353353

354354

355-
def create_serverless_variants():
356-
host = DEFAULT_HOST
357-
batchtime = BATCHTIME_WEEK
358-
tasks = [".serverless"]
359-
base_name = "Serverless"
360-
return [
361-
create_variant(
362-
tasks,
363-
get_variant_name(base_name, host, python=python),
364-
host=host,
365-
python=python,
366-
batchtime=batchtime,
367-
)
368-
for python in MIN_MAX_PYTHON
369-
]
370-
371-
372355
def create_oidc_auth_variants():
373356
variants = []
374357
for host_name in ["ubuntu22", "macos", "win64"]:
@@ -968,14 +951,6 @@ def create_free_threading_tasks():
968951
return [EvgTask(name=task_name, tags=tags, commands=[server_func, test_func])]
969952

970953

971-
def create_serverless_tasks():
972-
vars = dict(TEST_NAME="serverless", AUTH="auth", SSL="ssl")
973-
test_func = FunctionCall(func="run tests", vars=vars)
974-
tags = ["serverless"]
975-
task_name = "test-serverless"
976-
return [EvgTask(name=task_name, tags=tags, commands=[test_func])]
977-
978-
979954
##############
980955
# Functions
981956
##############

.evergreen/scripts/setup_tests.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,6 @@ def handle_test_env() -> None:
229229
config = read_env(f"{DRIVERS_TOOLS}/.evergreen/atlas_data_lake/secrets-export.sh")
230230
DB_USER = config["ADL_USERNAME"]
231231
DB_PASSWORD = config["ADL_PASSWORD"]
232-
elif test_name == "serverless":
233-
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/serverless/setup.sh")
234-
config = read_env(f"{DRIVERS_TOOLS}/.evergreen/serverless/secrets-export.sh")
235-
DB_USER = config["SERVERLESS_ATLAS_USER"]
236-
DB_PASSWORD = config["SERVERLESS_ATLAS_PASSWORD"]
237-
write_env("MONGODB_URI", config["SERVERLESS_URI"])
238-
write_env("SINGLE_MONGOS_LB_URI", config["SERVERLESS_URI"])
239-
write_env("MULTI_MONGOS_LB_URI", config["SERVERLESS_URI"])
240232
elif test_name == "auth_oidc":
241233
DB_USER = config["OIDC_ADMIN_USER"]
242234
DB_PASSWORD = config["OIDC_ADMIN_PWD"]

.evergreen/scripts/teardown_tests.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
elif TEST_NAME == "ocsp":
3737
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/ocsp/teardown.sh")
3838

39-
# Tear down serverless if applicable.
40-
elif TEST_NAME == "serverless":
41-
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/serverless/teardown.sh")
42-
4339
# Tear down atlas cluster if applicable.
4440
if TEST_NAME in ["aws_lambda", "search_index"]:
4541
run_command(f"bash {DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh")

.evergreen/scripts/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class Distro:
4545
"mockupdb": "mockupdb",
4646
"ocsp": "ocsp",
4747
"perf": "perf",
48-
"serverless": "",
4948
}
5049

5150
# Tests that require a sub test suite.
@@ -60,7 +59,6 @@ class Distro:
6059
"aws_lambda",
6160
"data_lake",
6261
"mockupdb",
63-
"serverless",
6462
"ocsp",
6563
]
6664

test/__init__.py

Lines changed: 38 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
MONGODB_API_VERSION,
6565
MULTI_MONGOS_LB_URI,
6666
TEST_LOADBALANCER,
67-
TEST_SERVERLESS,
6867
TLS_OPTIONS,
6968
SystemCertsPatcher,
7069
client_knobs,
@@ -123,9 +122,8 @@ def __init__(self):
123122
self.conn_lock = threading.Lock()
124123
self.is_data_lake = False
125124
self.load_balancer = TEST_LOADBALANCER
126-
self.serverless = TEST_SERVERLESS
127125
self._fips_enabled = None
128-
if self.load_balancer or self.serverless:
126+
if self.load_balancer:
129127
self.default_client_options["loadBalanced"] = True
130128
if COMPRESSORS:
131129
self.default_client_options["compressors"] = COMPRESSORS
@@ -167,7 +165,7 @@ def uri(self):
167165
@property
168166
def hello(self):
169167
if not self._hello:
170-
if self.serverless or self.load_balancer:
168+
if self.load_balancer:
171169
self._hello = self.client.admin.command(HelloCompat.CMD)
172170
else:
173171
self._hello = self.client.admin.command(HelloCompat.LEGACY_CMD)
@@ -222,24 +220,21 @@ def _init_client(self):
222220
if self.client:
223221
self.connected = True
224222

225-
if self.serverless:
226-
self.auth_enabled = True
227-
else:
228-
try:
229-
self.cmd_line = self.client.admin.command("getCmdLineOpts")
230-
except pymongo.errors.OperationFailure as e:
231-
assert e.details is not None
232-
msg = e.details.get("errmsg", "")
233-
if e.code == 13 or "unauthorized" in msg or "login" in msg:
234-
# Unauthorized.
235-
self.auth_enabled = True
236-
else:
237-
raise
223+
try:
224+
self.cmd_line = self.client.admin.command("getCmdLineOpts")
225+
except pymongo.errors.OperationFailure as e:
226+
assert e.details is not None
227+
msg = e.details.get("errmsg", "")
228+
if e.code == 13 or "unauthorized" in msg or "login" in msg:
229+
# Unauthorized.
230+
self.auth_enabled = True
238231
else:
239-
self.auth_enabled = self._server_started_with_auth()
232+
raise
233+
else:
234+
self.auth_enabled = self._server_started_with_auth()
240235

241236
if self.auth_enabled:
242-
if not self.serverless and not IS_SRV:
237+
if not IS_SRV:
243238
# See if db_user already exists.
244239
if not self._check_user_provided():
245240
_create_user(self.client.admin, db_user, db_pwd)
@@ -259,13 +254,10 @@ def _init_client(self):
259254
# May not have this if OperationFailure was raised earlier.
260255
self.cmd_line = self.client.admin.command("getCmdLineOpts")
261256

262-
if self.serverless:
263-
self.server_status = {}
264-
else:
265-
self.server_status = self.client.admin.command("serverStatus")
266-
if self.storage_engine == "mmapv1":
267-
# MMAPv1 does not support retryWrites=True.
268-
self.default_client_options["retryWrites"] = False
257+
self.server_status = self.client.admin.command("serverStatus")
258+
if self.storage_engine == "mmapv1":
259+
# MMAPv1 does not support retryWrites=True.
260+
self.default_client_options["retryWrites"] = False
269261

270262
hello = self.hello
271263
self.sessions_enabled = "logicalSessionTimeoutMinutes" in hello
@@ -302,42 +294,33 @@ def _init_client(self):
302294
self.w = len(hello.get("hosts", [])) or 1
303295
self.version = Version.from_client(self.client)
304296

305-
if self.serverless:
306-
self.server_parameters = {
307-
"requireApiVersion": False,
308-
"enableTestCommands": True,
309-
}
297+
self.server_parameters = self.client.admin.command("getParameter", "*")
298+
assert self.cmd_line is not None
299+
if self.server_parameters["enableTestCommands"]:
310300
self.test_commands_enabled = True
311-
self.has_ipv6 = False
312-
else:
313-
self.server_parameters = self.client.admin.command("getParameter", "*")
314-
assert self.cmd_line is not None
315-
if self.server_parameters["enableTestCommands"]:
301+
elif "parsed" in self.cmd_line:
302+
params = self.cmd_line["parsed"].get("setParameter", [])
303+
if "enableTestCommands=1" in params:
316304
self.test_commands_enabled = True
317-
elif "parsed" in self.cmd_line:
318-
params = self.cmd_line["parsed"].get("setParameter", [])
319-
if "enableTestCommands=1" in params:
305+
else:
306+
params = self.cmd_line["parsed"].get("setParameter", {})
307+
if params.get("enableTestCommands") == "1":
320308
self.test_commands_enabled = True
321-
else:
322-
params = self.cmd_line["parsed"].get("setParameter", {})
323-
if params.get("enableTestCommands") == "1":
324-
self.test_commands_enabled = True
325-
self.has_ipv6 = self._server_started_with_ipv6()
309+
self.has_ipv6 = self._server_started_with_ipv6()
326310

327311
self.is_mongos = (self.hello).get("msg") == "isdbgrid"
328312
if self.is_mongos:
329313
address = self.client.address
330314
self.mongoses.append(address)
331-
if not self.serverless:
332-
# Check for another mongos on the next port.
333-
assert address is not None
334-
next_address = address[0], address[1] + 1
335-
mongos_client = self._connect(*next_address, **self.default_client_options)
336-
if mongos_client:
337-
hello = mongos_client.admin.command(HelloCompat.LEGACY_CMD)
338-
if hello.get("msg") == "isdbgrid":
339-
self.mongoses.append(next_address)
340-
mongos_client.close()
315+
# Check for another mongos on the next port.
316+
assert address is not None
317+
next_address = address[0], address[1] + 1
318+
mongos_client = self._connect(*next_address, **self.default_client_options)
319+
if mongos_client:
320+
hello = mongos_client.admin.command(HelloCompat.LEGACY_CMD)
321+
if hello.get("msg") == "isdbgrid":
322+
self.mongoses.append(next_address)
323+
mongos_client.close()
341324

342325
def init(self):
343326
with self.conn_lock:
@@ -666,15 +649,9 @@ def require_no_load_balancer(self, func):
666649
lambda: not self.load_balancer, "Must not be connected to a load balancer", func=func
667650
)
668651

669-
def require_no_serverless(self, func):
670-
"""Run a test only if the client is not connected to serverless."""
671-
return self._require(
672-
lambda: not self.serverless, "Must not be connected to serverless", func=func
673-
)
674-
675652
def require_change_streams(self, func):
676653
"""Run a test only if the server supports change streams."""
677-
return self.require_no_mmap(self.require_no_standalone(self.require_no_serverless(func)))
654+
return self.require_no_mmap(self.require_no_standalone(func))
678655

679656
def is_topology_type(self, topologies):
680657
unknown = set(topologies) - {
@@ -1195,8 +1172,6 @@ class IntegrationTest(PyMongoTestCase):
11951172
def setUp(self) -> None:
11961173
if client_context.load_balancer and not getattr(self, "RUN_ON_LOAD_BALANCER", False):
11971174
raise SkipTest("this test does not support load balancers")
1198-
if client_context.serverless and not getattr(self, "RUN_ON_SERVERLESS", False):
1199-
raise SkipTest("this test does not support serverless")
12001175
self.client = client_context.client
12011176
self.db = self.client.pymongo_test
12021177
if client_context.auth_enabled:

0 commit comments

Comments
 (0)