|
| 1 | +# Copyright 2025-present MongoDB, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +from __future__ import annotations |
| 15 | + |
| 16 | +import os |
| 17 | +import sys |
| 18 | + |
| 19 | +sys.path[0:0] = [""] |
| 20 | + |
| 21 | +from test.asynchronous import ( |
| 22 | + AsyncIntegrationTest, |
| 23 | + async_client_context, |
| 24 | + unittest, |
| 25 | +) |
| 26 | +from test.asynchronous.unified_format import generate_test_classes |
| 27 | +from test.utils_shared import EventListener, OvertCommandListener |
| 28 | + |
| 29 | +_IS_SYNC = False |
| 30 | + |
| 31 | + |
| 32 | +class AsyncTestClientBackpressure(AsyncIntegrationTest): |
| 33 | + listener: EventListener |
| 34 | + |
| 35 | + @classmethod |
| 36 | + def setUpClass(cls) -> None: |
| 37 | + cls.listener = OvertCommandListener() |
| 38 | + |
| 39 | + @async_client_context.require_connection |
| 40 | + async def asyncSetUp(self) -> None: |
| 41 | + await super().asyncSetUp() |
| 42 | + self.listener.reset() |
| 43 | + self.client = await self.async_rs_or_single_client( |
| 44 | + event_listeners=[self.listener], retryWrites=False |
| 45 | + ) |
| 46 | + |
| 47 | + |
| 48 | +_TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "client-backpressure") |
| 49 | + |
| 50 | + |
| 51 | +globals().update( |
| 52 | + generate_test_classes( |
| 53 | + _TEST_PATH, |
| 54 | + module=__name__, |
| 55 | + ) |
| 56 | +) |
| 57 | + |
| 58 | +if __name__ == "__main__": |
| 59 | + unittest.main() |
0 commit comments