Updating 01247_insert_into_watch_live_view_url.py test

Updating httpechoserver.py
This commit is contained in:
Vitaliy Zakaznikov 2020-04-26 13:48:43 +02:00
parent f571a6b229
commit c09126e80f
3 changed files with 12 additions and 11 deletions

View File

@ -37,19 +37,19 @@ with client(name='client1>', log=log) as client1, client(name='client2>', log=lo
client1.expect(r'0.*1' + end_of_block)
time.sleep(0.25)
sys.stdout.write("-- first insert --\n")
sys.stdout.write(server.out.read())
sys.stdout.write(server.out.read() + "\n")
client2.send('INSERT INTO test.mt VALUES (1),(2),(3)')
client2.expect(prompt)
time.sleep(0.25)
sys.stdout.write("-- second insert --\n")
sys.stdout.write(server.out.read())
sys.stdout.write(server.out.read() + "\n")
client2.send('INSERT INTO test.mt VALUES (4),(5),(6)')
client2.expect(prompt)
time.sleep(0.25)
sys.stdout.write("-- third insert --\n")
sys.stdout.write(server.out.read())
sys.stdout.write(server.out.read() + "\n")
# send Ctrl-C
client1.send('\x03', eol='')

View File

@ -1,9 +1,9 @@
-- first insert --
0,1
-- second insert --
0,1
6,2
-- third insert --
0,1
6,2
21,3

View File

@ -3,16 +3,19 @@ from __future__ import print_function
import sys
import os
import time
import re
import subprocess
import threading
from io import StringIO, SEEK_END
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
ipv4_parser = re.compile('((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))')
CLICKHOUSE_HOST = os.environ.get('CLICKHOUSE_HOST', '127.0.0.1')
CLICKHOUSE_PORT_HTTP = os.environ.get('CLICKHOUSE_PORT_HTTP', '8123')
# IP-address of this host accessible from outside world.
HTTP_SERVER_HOST = subprocess.check_output(['hostname', '-i']).decode('utf-8').strip()
HTTP_SERVER_HOST = ipv4_parser.findall(subprocess.check_output(['hostname', '-i']).decode('utf-8').strip())[0][0]
HTTP_SERVER_PORT = int(os.environ.get('CLICKHOUSE_TEST_HOST_EXPOSED_PORT', 51234))
# IP address and port of the HTTP server started from this script.
@ -53,15 +56,13 @@ class EchoCSVHTTPServer(BaseHTTPRequestHandler):
return content.decode('utf-8')
def do_POST(self):
data = ''
while True:
chunk = self.read_chunk()
if not chunk:
break
data += chunk
pos = istream.tell()
istream.seek(SEEK_END)
istream.write(data)
istream.seek(0, SEEK_END)
istream.write(chunk)
istream.seek(pos)
text = ""
self._set_headers()