diff --git a/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.py b/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.py index de7b3dd10cb..eaf336eb9a9 100755 --- a/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.py +++ b/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.py @@ -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='') diff --git a/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.reference b/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.reference index 184d8f8e5a4..99bb308dbb5 100644 --- a/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.reference +++ b/tests/queries/0_stateless/01247_insert_into_watch_live_view_url.reference @@ -1,9 +1,9 @@ -- first insert -- 0,1 + -- second insert -- -0,1 6,2 + -- third insert -- -0,1 -6,2 21,3 + diff --git a/tests/queries/0_stateless/helpers/httpechoserver.py b/tests/queries/0_stateless/helpers/httpechoserver.py index 5687e4a94ce..ac6f098448c 100644 --- a/tests/queries/0_stateless/helpers/httpechoserver.py +++ b/tests/queries/0_stateless/helpers/httpechoserver.py @@ -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()