PYTHON-3909 Fix OIDC reauth for bulk write operations, remove unneeded AUTH_MECH (#1353)

Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
This commit is contained in:
Shane Harvey 2023-08-14 17:41:24 -07:00 committed by GitHub
parent 43845c36b2
commit 02de1ba00e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 6 deletions

View File

@ -51,7 +51,6 @@ if [ -z "$PYTHON_BINARY" ]; then
fi
export TEST_AUTH_OIDC=1
export AUTH_MECH="SCRAM-SHA-256"
export AUTH="auth"
export SET_XTRACE_ON=1
bash ./.evergreen/tox.sh -m test-eg

View File

@ -308,6 +308,7 @@ F = TypeVar("F", bound=Callable[..., Any])
def _handle_reauth(func: F) -> F:
def inner(*args: Any, **kwargs: Any) -> Any:
no_reauth = kwargs.pop("no_reauth", False)
from pymongo.message import _BulkWriteContext
from pymongo.pool import Connection
try:
@ -324,7 +325,7 @@ def _handle_reauth(func: F) -> F:
if isinstance(arg, Connection):
conn = arg
break
if hasattr(arg, "connection"):
if isinstance(arg, _BulkWriteContext):
conn = arg.conn
break
if conn:

View File

@ -95,7 +95,6 @@ TEST_LOADBALANCER = bool(os.environ.get("TEST_LOADBALANCER"))
TEST_SERVERLESS = bool(os.environ.get("TEST_SERVERLESS"))
SINGLE_MONGOS_LB_URI = os.environ.get("SINGLE_MONGOS_LB_URI")
MULTI_MONGOS_LB_URI = os.environ.get("MULTI_MONGOS_LB_URI")
AUTH_MECH = os.environ.get("AUTH_MECH")
if TEST_LOADBALANCER:
res = parse_uri(SINGLE_MONGOS_LB_URI or "")
@ -278,8 +277,6 @@ class ClientContext:
self.is_data_lake = False
self.load_balancer = TEST_LOADBALANCER
self.serverless = TEST_SERVERLESS
if AUTH_MECH:
self.default_client_options["authMechanism"] = AUTH_MECH
if self.load_balancer or self.serverless:
self.default_client_options["loadBalanced"] = True
if COMPRESSORS:
@ -347,7 +344,6 @@ class ClientContext:
def _init_client(self):
self.client = self._connect(host, port)
if self.client is not None:
# Return early when connected to dataLake as mongohoused does not
# support the getCmdLineOpts command and is tested without TLS.