Merge pull request #25551 from kssenii/add-test

Add test for progress bar
This commit is contained in:
Kseniia Sumarokova 2021-06-23 12:33:06 +03:00 committed by GitHub
commit 2e422c0e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View File

@ -577,7 +577,18 @@ private:
}
if (!history_file.empty() && !fs::exists(history_file))
FS::createFile(history_file);
{
/// Avoid TOCTOU issue.
try
{
FS::createFile(history_file);
}
catch (const ErrnoException & e)
{
if (e.getErrno() != EEXIST)
throw;
}
}
LineReader::Patterns query_extenders = {"\\"};
LineReader::Patterns query_delimiters = {";", "\\G"};

View File

@ -0,0 +1,19 @@
#!/usr/bin/env python3
import os
import sys
import signal
CURDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(CURDIR, 'helpers'))
from client import client, prompt, end_of_block
log = None
# uncomment the line below for debugging
#log=sys.stdout
with client(name='client1>', log=log) as client1:
client1.expect(prompt)
client1.send('SELECT number FROM numbers(100) FORMAT Null')
client1.expect('Progress: 100\.00 rows, 800\.00 B.*' + end_of_block)
client1.expect('0 rows in set. Elapsed: [\\w]{1}\.[\\w]{3} sec.' + end_of_block)