Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
As discussed in https://reviews.apache.org/r/69064/ , we should try to add a unit test that verifies that simultaneous requests with different accept encoding headers produce different responses.
It could look like this:
TEST_F(MasterLoadTest, AcceptEncoding) { MockAuthorizer authorizer; prepareCluster(&authorizer); Headers authHeaders = createBasicAuthHeaders(DEFAULT_CREDENTIAL); Headers acceptGzipHeaders = {{"Accept-Encoding", "gzip"}}; Headers acceptRawHeaders = {{"Accept-Encoding", "raw"}}; RequestDescriptor descriptor1; descriptor1.endpoint = "/state"; descriptor1.headers = authHeaders + acceptGzipHeaders; RequestDescriptor descriptor2 = descriptor1; descriptor2.headers = authHeaders + acceptRawHeaders; auto responses = launchSimultaneousRequests({descriptor1, descriptor2}); foreachpair ( const RequestDescriptor& request, Future<Response>& response, responses) { AWAIT_READY(response); ASSERT_SOME(request.headers.get("Accept-Encoding")); if (request.headers.get("Accept-Encoding").get() == "gzip") { ASSERT_SOME(response->headers.get("Content-Encoding")); EXPECT_EQ(response->headers.get("Content-Encoding").get(), "gzip"); } else { EXPECT_NONE(response->headers.get("Content-Encoding")); } } // Ensure that we actually hit the metrics code path while executing // the test. JSON::Object metrics = Metrics(); ASSERT_TRUE(metrics.values["master/http_cache_hits"].is<JSON::Number>()); ASSERT_GT( metrics.values["master/http_cache_hits"].as<JSON::Number>().as<size_t>(), 0u); }
Attachments
Issue Links
- is blocked by
-
MESOS-9490 Gzip responses no longer supported via http::get.
- Accepted