Test that the HTTP server can successfuly read chunked requests. None of our usual clients are capable of generating chunked requests directly, but we may still have to process chunked requests, eg. if the requests are being proxied through something like Apache Knox, so we use curl to test it. Unfortunately, its difficult to craft a request that Thrift will actually recognize as an rpc, so mostly
| 104 | // difficult to craft a request that Thrift will actually recognize as an rpc, so mostly |
| 105 | // what we're really testing here is just that the server doesn't hang or crash. |
| 106 | TEST(ThriftHttpTest, TestChunkedRequests) { |
| 107 | std::shared_ptr<TestHS2Service> service(new TestHS2Service()); |
| 108 | std::shared_ptr<TProcessor> hs2_http_processor( |
| 109 | new ImpalaHiveServer2ServiceProcessor(service)); |
| 110 | int port = FindUnusedEphemeralPort(); |
| 111 | ThriftServer* http_server; |
| 112 | ThriftServerBuilder http_builder("test-http-server", hs2_http_processor, port); |
| 113 | ASSERT_OK( |
| 114 | http_builder.transport_type(ThriftServer::TransportType::HTTP).Build(&http_server)); |
| 115 | ASSERT_OK(http_server->Start()); |
| 116 | |
| 117 | string curl_output; |
| 118 | // Only run this if curl is available. |
| 119 | if (RunShellProcess("curl --version", &curl_output)) { |
| 120 | string host = Substitute("http://127.0.0.1:$0", port); |
| 121 | // Send a plain, non-chunked request. |
| 122 | system(Substitute("curl -X POST -v '$0'", host).c_str()); |
| 123 | // Send a chunked request with a small amount of data. |
| 124 | system(Substitute("curl -d somedata -H 'Transfer-Encoding: chunked' -v '$0'", host) |
| 125 | .c_str()); |
| 126 | string filename = Substitute("$0/testdata/data/decimal_rtf_tbl.txt", IMPALA_HOME); |
| 127 | EXPECT_TRUE(filesystem::exists(filename)); |
| 128 | // Send a chunked request with a large amount of data. |
| 129 | system( |
| 130 | Substitute("curl -d @$0 -H 'Transfer-Encoding: chunked' -v '$1'", filename, host) |
| 131 | .c_str()); |
| 132 | } else { |
| 133 | LOG(INFO) << "Skipping test, curl was not present: " << curl_output; |
| 134 | } |
| 135 | |
| 136 | http_server->StopForTesting(); |
| 137 | } |
| 138 | |
| 139 | // Test that the HTTP server can be connected to successfully with Kerberos. |
| 140 | TEST(Hs2HttpTest, TestSpnego) { |
nothing calls this directly
no test coverage detected