Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test to test for accept-encoding: gzip #883

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions tests/integration/test_integration_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,32 @@ async def async_is_http2_client(self, app):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.http_version, "HTTP/2")

def sync_client_accept_encoding_gzip(self, app):
data = {
"yql": "select * from sources * where true",
"hits": 10,
}
with app.syncio() as sync_app:
response = sync_app.http_session.post(app.search_end_point, json=data)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.headers["content-encoding"], "gzip")
# Check that gzip is in request headers
self.assertIn("gzip", response.request.headers["Accept-Encoding"])

async def async_client_accept_encoding_gzip(self, app):
data = {
"yql": "select * from sources * where true",
"hits": 10,
}
async with app.asyncio() as async_app:
response = await async_app.httpx_client.post(
app.search_end_point, json=data
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.headers["content-encoding"], "gzip")
# Check that gzip is in request headers
self.assertIn("gzip", response.request.headers["Accept-Encoding"])

def execute_data_operations(
self,
app,
Expand Down Expand Up @@ -946,6 +972,12 @@ def setUp(self) -> None:
def test_is_using_http2_client(self):
asyncio.run(self.async_is_http2_client(app=self.app))

def test_sync_client_accept_encoding(self):
self.sync_client_accept_encoding_gzip(app=self.app)

def test_async_client_accept_encoding(self):
asyncio.run(self.async_client_accept_encoding_gzip(app=self.app))

def test_handle_longlived_connection(self):
asyncio.run(self.handle_longlived_connection(app=self.app))

Expand Down Expand Up @@ -1102,6 +1134,12 @@ def sentence_to_doc(sentences):
)
self.app.delete_all_docs(content_cluster_name="qa_content", schema="sentence")

def test_sync_client_accept_encoding(self):
self.sync_client_accept_encoding_gzip(app=self.app)

def test_async_client_accept_encoding(self):
asyncio.run(self.async_client_accept_encoding_gzip(app=self.app))

def tearDown(self) -> None:
self.vespa_docker.container.stop(timeout=CONTAINER_STOP_TIMEOUT)
self.vespa_docker.container.remove()
Expand Down
Loading