SERVER-126230: move uds socket path from tmp (#53424)
GitOrigin-RevId: b407dd84a6308a195a71a126ec367f40461b84a2
This commit is contained in:
parent
8b100f357d
commit
7cdde2ce36
@ -85,7 +85,7 @@ class ReplicaSetFixture(interface.ReplFixture, interface._DockerComposeInterface
|
||||
skip_extensions_signature_verification=False,
|
||||
router_endpoint_for_mongot: Optional[int] = None,
|
||||
use_priority_ports=False,
|
||||
uds_path_prefix: Optional[str] = None,
|
||||
uds_path_prefix: Optional[str | bool] = None,
|
||||
):
|
||||
"""Initialize ReplicaSetFixture."""
|
||||
|
||||
|
||||
@ -998,6 +998,8 @@ class _MongoSFixture(interface.Fixture, interface._DockerComposeInterface):
|
||||
self.mongos_options["priorityPort"] = self.priority_port
|
||||
|
||||
# Unix domain socket support
|
||||
if uds_path_prefix is True:
|
||||
uds_path_prefix = dbpath_prefix
|
||||
self.uds_path_prefix = uds_path_prefix
|
||||
self.uds_path = None
|
||||
if self.uds_path_prefix:
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
import uuid
|
||||
from typing import Optional
|
||||
@ -44,7 +45,7 @@ class MongoDFixture(interface.Fixture, interface._DockerComposeInterface):
|
||||
load_extensions=None,
|
||||
skip_extensions_signature_verification=False,
|
||||
use_priority_port: bool = False,
|
||||
uds_path_prefix: Optional[str] = None,
|
||||
uds_path_prefix: Optional[str | bool] = None,
|
||||
):
|
||||
"""Initialize MongoDFixture with different options for the mongod process.
|
||||
|
||||
@ -66,7 +67,8 @@ class MongoDFixture(interface.Fixture, interface._DockerComposeInterface):
|
||||
Use specific names (e.g. ["add_fields_match"]) to load individual extensions.
|
||||
Defaults to None (no extensions loaded).
|
||||
use_priority_port (bool, optional): Whether to open a priority port on this node at startup. Defaults to False.
|
||||
uds_path_prefix (Optional[str], optional): Directory prefix for Unix domain socket. Defaults to None.
|
||||
uds_path_prefix (Optional[str | bool], optional): Directory prefix for Unix domain socket.
|
||||
Pass True to use the mongod data directory as the prefix. Defaults to None.
|
||||
|
||||
Raises
|
||||
ValueError: _description_
|
||||
@ -140,6 +142,8 @@ class MongoDFixture(interface.Fixture, interface._DockerComposeInterface):
|
||||
self.mongod_options["port"] = self.port
|
||||
|
||||
# Unix domain socket support
|
||||
if uds_path_prefix is True:
|
||||
uds_path_prefix = self._dbpath if sys.platform != "win32" else None
|
||||
self.uds_path_prefix = uds_path_prefix
|
||||
self.uds_path = None
|
||||
if self.uds_path_prefix:
|
||||
|
||||
@ -10,4 +10,4 @@ executor:
|
||||
mongod_options:
|
||||
set_parameters:
|
||||
enableTestCommands: 1
|
||||
uds_path_prefix: /tmp/mongodb-test-sockets
|
||||
uds_path_prefix: True
|
||||
|
||||
@ -11,4 +11,4 @@ executor:
|
||||
set_parameters:
|
||||
enableTestCommands: 1
|
||||
num_nodes: 3
|
||||
uds_path_prefix: /tmp/mongodb-test-sockets
|
||||
uds_path_prefix: True
|
||||
|
||||
@ -15,4 +15,4 @@ executor:
|
||||
enableTestCommands: 1
|
||||
num_shards: 2
|
||||
num_rs_nodes_per_shard: 2
|
||||
uds_path_prefix: /tmp/mongodb-test-sockets
|
||||
uds_path_prefix: True
|
||||
|
||||
@ -33,7 +33,7 @@ class TestFixtureUDSEnvironmentVariables(unittest.TestCase):
|
||||
|
||||
# Verify it contains the expected prefix
|
||||
self.assertIn(
|
||||
"/tmp/mongodb-test-sockets",
|
||||
"/data/db",
|
||||
uds_path,
|
||||
f"UDS path should contain the configured prefix: {uds_path}",
|
||||
)
|
||||
|
||||
@ -49,7 +49,7 @@ class TestReplicaSetFixtureUDSEnvironmentVariables(unittest.TestCase):
|
||||
|
||||
# Verify it contains the expected prefix
|
||||
self.assertIn(
|
||||
"/tmp/mongodb-test-sockets",
|
||||
"/data/db",
|
||||
uds_path,
|
||||
f"UDS path should contain the configured prefix: {uds_path}",
|
||||
)
|
||||
|
||||
@ -42,7 +42,7 @@ class TestShardedClusterFixtureUDSEnvironmentVariables(unittest.TestCase):
|
||||
uds_path.endswith(".sock"), f"UDS path should end with .sock: {uds_path}"
|
||||
)
|
||||
self.assertIn(
|
||||
"/tmp/mongodb-test-sockets",
|
||||
"/data/db",
|
||||
uds_path,
|
||||
f"UDS path should contain the configured prefix: {uds_path}",
|
||||
)
|
||||
@ -81,7 +81,7 @@ class TestShardedClusterFixtureUDSEnvironmentVariables(unittest.TestCase):
|
||||
|
||||
# Verify it contains the expected prefix
|
||||
self.assertIn(
|
||||
"/tmp/mongodb-test-sockets",
|
||||
"/data/db",
|
||||
uds_path,
|
||||
f"UDS path should contain the configured prefix: {uds_path}",
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user