From d2841abe5c6dbba04cc9d2926e4e39d6bbfc6d81 Mon Sep 17 00:00:00 2001 From: Yang Xiufeng Date: Fri, 8 Jul 2022 16:01:18 +0800 Subject: [PATCH] add unit tests. --- query/tests/it/servers/http/http_query_handlers.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/query/tests/it/servers/http/http_query_handlers.rs b/query/tests/it/servers/http/http_query_handlers.rs index cbdabcef7da3..9749e37816d7 100644 --- a/query/tests/it/servers/http/http_query_handlers.rs +++ b/query/tests/it/servers/http/http_query_handlers.rs @@ -1107,6 +1107,20 @@ async fn test_download(v2: u64) -> Result<()> { fmt ); } + + // test download with limits + let uri = format!("/v1/query/{query_id}/download?limit=1"); + let resp = get_uri(&ep, &uri).await; + assert_eq!(resp.status(), StatusCode::OK, "{:?}", resp); + let exp = "0,1\n"; + assert_eq!(resp.into_body().into_string().await.unwrap(), exp); + + let uri = format!("/v1/query/{query_id}/download?limit=0"); + let resp = get_uri(&ep, &uri).await; + assert_eq!(resp.status(), StatusCode::OK, "{:?}", resp); + let exp = "0,1\n1,2\n"; + assert_eq!(resp.into_body().into_string().await.unwrap(), exp); + Ok(()) }