Automatic style fix

This commit is contained in:
robot-clickhouse 2022-10-08 00:09:24 +00:00
parent 6bb62d4d03
commit 3bed015a1f

View File

@ -46,6 +46,7 @@ def execute_query_http(host, port, query):
response = urllib.request.urlopen(request).read()
return response.decode("utf-8")
def netcat(hostname, port, content):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((hostname, port))
@ -58,7 +59,8 @@ def netcat(hostname, port, content):
break
data.append(d)
s.close()
return b''.join(data)
return b"".join(data)
def test_connections():
@ -83,5 +85,10 @@ def test_connections():
assert execute_query_https(server.ip_address, 8444, "SELECT 1") == "1\n"
data = "PROXY TCP4 255.255.255.255 255.255.255.255 65535 65535\r\n\0\021ClickHouse client\024\r\253\251\003\0\007default\0\004\001\0\001\0\0\t0.0.0.0:0\001\tmilovidov\021milovidov-desktop\vClickHouse \024\r\253\251\003\0\001\0\0\0\002\001\025SELECT \'Hello, world\'\002\0\247\203\254l\325\\z|\265\254F\275\333\206\342\024\202\024\0\0\0\n\0\0\0\240\01\0\02\377\377\377\377\0\0\0"
assert netcat(server.ip_address, 9100, bytearray(data, "latin-1")).find(bytearray("Hello, world", "latin-1")) >= 0
data = "PROXY TCP4 255.255.255.255 255.255.255.255 65535 65535\r\n\0\021ClickHouse client\024\r\253\251\003\0\007default\0\004\001\0\001\0\0\t0.0.0.0:0\001\tmilovidov\021milovidov-desktop\vClickHouse \024\r\253\251\003\0\001\0\0\0\002\001\025SELECT 'Hello, world'\002\0\247\203\254l\325\\z|\265\254F\275\333\206\342\024\202\024\0\0\0\n\0\0\0\240\01\0\02\377\377\377\377\0\0\0"
assert (
netcat(server.ip_address, 9100, bytearray(data, "latin-1")).find(
bytearray("Hello, world", "latin-1")
)
>= 0
)