fix tests

This commit is contained in:
Anton Popov 2022-11-28 21:15:41 +00:00
parent e0dd533811
commit 486da48ae7
5 changed files with 21 additions and 17 deletions

View File

@ -1,4 +1,3 @@
#include "base/types.h"
#include "config.h"
#include <Common/ProfileEvents.h>
#include "IO/ParallelReadBuffer.h"
@ -481,7 +480,7 @@ StorageS3Source::ReaderHolder StorageS3Source::createReader()
size_t object_size = info
? info->size
: S3::getObjectSize(client, bucket, current_key, version_id, false, false);
: S3::getObjectSize(client, bucket, current_key, version_id, true, false);
int zstd_window_log_max = static_cast<int>(getContext()->getSettingsRef().zstd_window_log_max);
auto read_buf = wrapReadBufferWithCompressionMethod(

View File

@ -3,17 +3,20 @@ import sys
class RequestHandler(http.server.BaseHTTPRequestHandler):
def do_HEAD(self):
def get_response(self):
if self.path.startswith("/get-my-path/"):
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.end_headers()
return b"/" + self.path.split("/", maxsplit=2)[2].encode()
elif self.path == "/":
return b"OK"
return None
def do_HEAD(self):
if self.path.startswith("/get-my-path/") or self.path == "/":
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.send_header("Content-Length", len(self.get_response()))
self.end_headers()
else:
self.send_response(404)
self.send_header("Content-Type", "text/plain")
@ -21,11 +24,7 @@ class RequestHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.do_HEAD()
if self.path.startswith("/get-my-path/"):
self.wfile.write(b"/" + self.path.split("/", maxsplit=2)[2].encode())
elif self.path == "/":
self.wfile.write(b"OK")
self.wfile.write(self.get_response())
httpd = http.server.HTTPServer(("0.0.0.0", int(sys.argv[1])), RequestHandler)

View File

@ -14,14 +14,20 @@ def infinite_redirect(_path):
def server(_bucket, _path):
for name in request.headers:
if name == "Authorization" and request.headers[name] == "Bearer TOKEN":
return "1, 2, 3"
result = "1, 2, 3"
response.headers["Content-Length"] = len(result)
return result
result = '<?xml version="1.0" encoding="UTF-8"?><Error><Code>ForbiddenError</Code><Message>Forbidden Error</Message><RequestId>txfbd566d03042474888193-00608d7537</RequestId></Error>'
response.status = 403
response.content_type = "text/xml"
return '<?xml version="1.0" encoding="UTF-8"?><Error><Code>ForbiddenError</Code><Message>Forbidden Error</Message><RequestId>txfbd566d03042474888193-00608d7537</RequestId></Error>'
response.set_header("Content-Length", len(result))
return result
@route("/")
def ping():
response.set_header("Content-Length", 2)
return "OK"

View File

@ -1,2 +1,2 @@
http://localhost:11111/test/tsv_with_header.tsv
test/tsv_with_header.tsv
tsv_with_header.tsv

View File

@ -6,4 +6,4 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CUR_DIR"/../shell_config.sh
${CLICKHOUSE_CLIENT} --query "SELECT * FROM url('http://localhost:11111/test/{a,tsv_with_header}.tsv', 'TSV', 'c1 UInt64, c2 UInt64, c3 UInt64')" 2>&1 | grep -o -m1 "http://localhost:11111/test/tsv_with_header.tsv"
${CLICKHOUSE_CLIENT} --query "SELECT * FROM s3('http://localhost:11111/test/{a,tsv_with_header}.tsv', 'TSV', 'c1 UInt64, c2 UInt64, c3 UInt64')" 2>&1 | grep -o -m1 "test/tsv_with_header.tsv"
${CLICKHOUSE_CLIENT} --query "SELECT * FROM s3('http://localhost:11111/test/{a,tsv_with_header}.tsv', 'TSV', 'c1 UInt64, c2 UInt64, c3 UInt64')" 2>&1 | grep -o -m1 "tsv_with_header.tsv"