Beispiel #1
0
 def test_timeout(self) -> None:
     options = RpcOptions()
     self.assertEqual(0, options.timeout)
     options.timeout = 0.05
     self.assertEqual(0.05, options.timeout)
     options.chunk_timeout = options.queue_timeout = options.timeout
     self.assertEqual(options.chunk_timeout, options.queue_timeout)
     with self.assertRaises(TypeError):
         options.timeout = "1"  # type: ignore
 def test_timeout(self) -> None:
     options = RpcOptions()
     self.assertEqual(0, options.timeout)
     options.timeout = 0.05
     self.assertEqual(0.05, options.timeout)
     options.chunk_timeout = options.queue_timeout = options.timeout
     self.assertEqual(options.chunk_timeout, options.queue_timeout)
     with self.assertRaises(TypeError):
         # pyre-fixme[8]: Attribute has type `float`; used as `str`.
         options.timeout = "1"
Beispiel #3
0
        async def inner_test() -> None:
            async with TestServer(ip="::1") as sa:
                ip, port = sa.ip, sa.port
                assert ip and port
                async with get_client(TestingService, host=ip,
                                      port=port) as client:
                    options = RpcOptions()
                    options.timeout = 100.0

                    self.assertEqual("Testing", await
                                     client.getName(rpc_options=options))
                    self.assertEqual("true",
                                     options.read_headers["contextvar"])
                    self.assertEqual(
                        "getMethodName",
                        await client.getMethodName(),
                    )
                    # requestId is a 16 char wide hex string
                    self.assertEqual(
                        len(await client.getRequestId()),
                        16,
                    )
                    self.assertEqual(
                        100.0,
                        await client.getRequestTimeout(rpc_options=options),
                    )