Speed up tests execution.
GitOrigin-RevId: 5bcac989d87a04ef8510c47232e3525c4e610073
This commit is contained in:
parent
b344269688
commit
a02f8d610d
@ -111,7 +111,7 @@ Result<size_t> HttpReader::read_next(HttpQuery *query) {
|
||||
gzip_flow_ = GzipByteFlow(Gzip::Mode::Decode);
|
||||
GzipByteFlow::Options options;
|
||||
options.write_watermark.low = 0;
|
||||
options.write_watermark.high = max_post_size_;
|
||||
options.write_watermark.high = max(max_post_size_, static_cast<size_t>(1 << 16));
|
||||
gzip_flow_.set_options(options);
|
||||
gzip_flow_.set_max_output_size(MAX_CONTENT_SIZE);
|
||||
*source >> gzip_flow_;
|
||||
|
@ -379,4 +379,5 @@ class ByteFlowMoveSink : public ByteFlowInterface {
|
||||
ChainBufferReader *input_ = nullptr;
|
||||
ChainBufferWriter *output_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
@ -126,7 +126,7 @@ TEST(Gzip, encode_decode_flow_big) {
|
||||
td::clear_thread_locals();
|
||||
auto start_mem = td::BufferAllocator::get_buffer_mem();
|
||||
{
|
||||
auto str = std::string(1000000, 'a');
|
||||
auto str = std::string(200000, 'a');
|
||||
td::ChainBufferWriter input_writer;
|
||||
auto input = input_writer.extract_reader();
|
||||
td::ByteFlowSource source(&input);
|
||||
@ -179,7 +179,7 @@ TEST(Gzip, decode_encode_flow_bomb) {
|
||||
td::ByteFlowSink sink;
|
||||
source >> gzip_flow >> sink;
|
||||
|
||||
std::string s(1 << 20, 'a');
|
||||
std::string s(1 << 16, 'a');
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
input_writer.append(s);
|
||||
source.wakeup();
|
||||
@ -218,7 +218,7 @@ TEST(Gzip, decode_encode_flow_bomb) {
|
||||
sink;
|
||||
|
||||
ASSERT_TRUE(!sink.is_ready());
|
||||
size_t left_size = N * (1 << 20);
|
||||
size_t left_size = N * (1 << 16);
|
||||
auto validate = [&](td::Slice chunk) {
|
||||
CHECK(chunk.size() <= left_size);
|
||||
left_size -= chunk.size();
|
||||
@ -234,8 +234,8 @@ TEST(Gzip, decode_encode_flow_bomb) {
|
||||
gzip_decode_flow.wakeup();
|
||||
source.wakeup();
|
||||
auto extra_mem = td::BufferAllocator::get_buffer_mem() - start_mem;
|
||||
// limit means nothing. just check that we do not use 200Mb or so
|
||||
CHECK(extra_mem < (10 << 20));
|
||||
// limit means nothing. just check that we do not use 15Mb or so
|
||||
CHECK(extra_mem < (5 << 20));
|
||||
auto size = sink.get_output()->size();
|
||||
validate(sink.get_output()->cut_head(size).move_as_buffer_slice().as_slice());
|
||||
} while (!sink.is_ready());
|
||||
|
@ -383,8 +383,8 @@ TEST(Http, gzip_bomb_with_limit) {
|
||||
ByteFlowSink sink;
|
||||
source >> gzip_flow >> sink;
|
||||
|
||||
std::string s(1 << 20, 'a');
|
||||
for (int i = 0; i < 2000; i++) {
|
||||
std::string s(1 << 16, 'a');
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
input_writer.append(s);
|
||||
source.wakeup();
|
||||
}
|
||||
@ -411,7 +411,6 @@ TEST(Http, gzip_bomb_with_limit) {
|
||||
LOG(FATAL) << r_state.error();
|
||||
return;
|
||||
} else if (r_state.ok() == 0) {
|
||||
LOG(ERROR) << q;
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user