Skip to content

Commit 0441761

Browse files
authored
PYTHON-5715 Add appName to OIDC test failpoints (#2697)
1 parent fdb6a32 commit 0441761

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

test/asynchronous/test_auth_oidc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ def get_token(self, username=None):
104104

105105
@asynccontextmanager
106106
async def fail_point(self, command_args):
107-
cmd_on = SON([("configureFailPoint", "failCommand")])
107+
cmd_on = dict(configureFailPoint="failCommand", appName="auth_oidc")
108108
cmd_on.update(command_args)
109109
client = AsyncMongoClient(self.uri_admin)
110110
await client.admin.command(cmd_on)
111111
try:
112112
yield
113113
finally:
114114
await client.admin.command(
115-
"configureFailPoint", cmd_on["configureFailPoint"], mode="off"
115+
"configureFailPoint", cmd_on["configureFailPoint"], mode="off", appName="auth_oidc"
116116
)
117117
await client.close()
118118

test/auth/unified/mongodb-oidc-no-retry.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"$$placeholder": 1
2626
},
2727
"retryReads": false,
28-
"retryWrites": false
28+
"retryWrites": false,
29+
"appName": "mongodb-oidc-no-retry"
2930
},
3031
"observeEvents": [
3132
"commandStartedEvent",
@@ -147,7 +148,8 @@
147148
"failCommands": [
148149
"find"
149150
],
150-
"errorCode": 391
151+
"errorCode": 391,
152+
"appName": "mongodb-oidc-no-retry"
151153
}
152154
}
153155
}
@@ -212,7 +214,8 @@
212214
"failCommands": [
213215
"insert"
214216
],
215-
"errorCode": 391
217+
"errorCode": 391,
218+
"appName": "mongodb-oidc-no-retry"
216219
}
217220
}
218221
}
@@ -289,7 +292,8 @@
289292
"failCommands": [
290293
"insert"
291294
],
292-
"closeConnection": true
295+
"closeConnection": true,
296+
"appName": "mongodb-oidc-no-retry"
293297
}
294298
}
295299
}
@@ -321,7 +325,8 @@
321325
"failCommands": [
322326
"saslStart"
323327
],
324-
"errorCode": 18
328+
"errorCode": 18,
329+
"appName": "mongodb-oidc-no-retry"
325330
}
326331
}
327332
}
@@ -398,7 +403,8 @@
398403
"failCommands": [
399404
"saslStart"
400405
],
401-
"errorCode": 18
406+
"errorCode": 18,
407+
"appName": "mongodb-oidc-no-retry"
402408
}
403409
}
404410
}

test/test_auth_oidc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,16 @@ def get_token(self, username=None):
104104

105105
@contextmanager
106106
def fail_point(self, command_args):
107-
cmd_on = SON([("configureFailPoint", "failCommand")])
107+
cmd_on = dict(configureFailPoint="failCommand", appName="auth_oidc")
108108
cmd_on.update(command_args)
109109
client = MongoClient(self.uri_admin)
110110
client.admin.command(cmd_on)
111111
try:
112112
yield
113113
finally:
114-
client.admin.command("configureFailPoint", cmd_on["configureFailPoint"], mode="off")
114+
client.admin.command(
115+
"configureFailPoint", cmd_on["configureFailPoint"], mode="off", appName="auth_oidc"
116+
)
115117
client.close()
116118

117119

0 commit comments

Comments
 (0)