(self)
| 214 | @ignore_deprecations |
| 215 | @async_client_context.require_sync |
| 216 | async def test_gssapi_threaded(self): |
| 217 | client = self.simple_client( |
| 218 | GSSAPI_HOST, |
| 219 | GSSAPI_PORT, |
| 220 | username=GSSAPI_PRINCIPAL, |
| 221 | password=GSSAPI_PASS, |
| 222 | authMechanism="GSSAPI", |
| 223 | authMechanismProperties=self.mech_properties, |
| 224 | ) |
| 225 | |
| 226 | # Authentication succeeded? |
| 227 | await client.server_info() |
| 228 | db = client[GSSAPI_DB] |
| 229 | |
| 230 | # Need one document in the collection. AutoAuthenticateThread does |
| 231 | # collection.find_one with a 1-second delay, forcing it to check out |
| 232 | # multiple connections from the pool concurrently, proving that |
| 233 | # auto-authentication works with GSSAPI. |
| 234 | collection = db.test |
| 235 | if not await collection.count_documents({}): |
| 236 | try: |
| 237 | await collection.drop() |
| 238 | await collection.insert_one({"_id": 1}) |
| 239 | except OperationFailure: |
| 240 | raise SkipTest("User must be able to write.") |
| 241 | |
| 242 | threads = [] |
| 243 | for _ in range(4): |
| 244 | threads.append(AutoAuthenticateThread(collection)) |
| 245 | for thread in threads: |
| 246 | thread.start() |
| 247 | for thread in threads: |
| 248 | thread.join() |
| 249 | self.assertTrue(thread.success) |
| 250 | |
| 251 | set_name = async_client_context.replica_set_name |
| 252 | if set_name: |
| 253 | client = self.simple_client( |
| 254 | GSSAPI_HOST, |
| 255 | GSSAPI_PORT, |
| 256 | username=GSSAPI_PRINCIPAL, |
| 257 | password=GSSAPI_PASS, |
| 258 | authMechanism="GSSAPI", |
| 259 | authMechanismProperties=self.mech_properties, |
| 260 | replicaSet=set_name, |
| 261 | ) |
| 262 | |
| 263 | # Succeeded? |
| 264 | await client.server_info() |
| 265 | |
| 266 | threads = [] |
| 267 | for _ in range(4): |
| 268 | threads.append(AutoAuthenticateThread(collection)) |
| 269 | for thread in threads: |
| 270 | thread.start() |
| 271 | for thread in threads: |
| 272 | thread.join() |
| 273 | self.assertTrue(thread.success) |
nothing calls this directly
no test coverage detected