def test_server_manipulate_config(self) -> None: MAX_REQUESTS = 142 MAX_CONNECTIONS = 132 LISTEN_BACKLOG = 167 NUM_IO_WORKERS = 10 IDLE_TIMEOUT = 19.84 QUEUE_TIMEOUT = 20.19 # pyre-fixme[45]: Cannot instantiate abstract class `Handler`. server = ThriftServer(Handler(), port=0) server.set_max_requests(MAX_REQUESTS) server.set_max_connections(MAX_CONNECTIONS) server.set_listen_backlog(LISTEN_BACKLOG) server.set_io_worker_threads(NUM_IO_WORKERS) server.set_idle_timeout(IDLE_TIMEOUT) server.set_queue_timeout(QUEUE_TIMEOUT) self.assertEqual(server.get_max_requests(), MAX_REQUESTS) self.assertEqual(server.get_max_connections(), MAX_CONNECTIONS) self.assertEqual(server.get_listen_backlog(), LISTEN_BACKLOG) self.assertEqual(server.get_io_worker_threads(), NUM_IO_WORKERS) self.assertEqual(server.get_idle_timeout(), IDLE_TIMEOUT) self.assertEqual(server.get_queue_timeout(), QUEUE_TIMEOUT) self.assertFalse(server.is_plaintext_allowed_on_loopback()) server.set_allow_plaintext_on_loopback(True) self.assertTrue(server.is_plaintext_allowed_on_loopback())
def test_server_manipulate_config(self) -> None: MAX_REQUESTS = 142 MAX_CONNECTIONS = 132 LISTEN_BACKLOG = 167 NUM_IO_WORKERS = 10 NUM_CPU_WORKERS = 42 NUM_SSL_WORKERS = 12 IDLE_TIMEOUT = 19.84 QUEUE_TIMEOUT = 20.19 server = ThriftServer(Handler(), port=0) server.set_max_requests(MAX_REQUESTS) server.set_max_connections(MAX_CONNECTIONS) server.set_listen_backlog(LISTEN_BACKLOG) server.set_io_worker_threads(NUM_IO_WORKERS) server.set_cpu_worker_threads(NUM_CPU_WORKERS) server.set_ssl_handshake_worker_threads(NUM_SSL_WORKERS) server.set_idle_timeout(IDLE_TIMEOUT) server.set_queue_timeout(QUEUE_TIMEOUT) self.assertEqual(server.get_max_requests(), MAX_REQUESTS) self.assertEqual(server.get_max_connections(), MAX_CONNECTIONS) self.assertEqual(server.get_listen_backlog(), LISTEN_BACKLOG) self.assertEqual(server.get_io_worker_threads(), NUM_IO_WORKERS) self.assertEqual(server.get_cpu_worker_threads(), NUM_CPU_WORKERS) self.assertEqual(server.get_ssl_handshake_worker_threads(), NUM_SSL_WORKERS) self.assertEqual(server.get_idle_timeout(), IDLE_TIMEOUT) self.assertEqual(server.get_queue_timeout(), QUEUE_TIMEOUT) self.assertFalse(server.is_plaintext_allowed_on_loopback()) server.set_allow_plaintext_on_loopback(True) self.assertTrue(server.is_plaintext_allowed_on_loopback())