Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
72ca3151
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
72ca3151
编写于
5月 04, 2020
作者:
A
alexey-milovidov
提交者:
GitHub
5月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10604 from vzakaznikov/fix_timeouts_in_new_live_view_tests
Fixing hard coded timeouts in new live view tests.
上级
1c892734
e6a8521d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
186 addition
and
9 deletion
+186
-9
tests/queries/0_stateless/01246_insert_into_watch_live_view.py
.../queries/0_stateless/01246_insert_into_watch_live_view.py
+78
-0
tests/queries/0_stateless/01246_insert_into_watch_live_view.reference
...s/0_stateless/01246_insert_into_watch_live_view.reference
+0
-0
tests/queries/0_stateless/01247_insert_into_watch_live_view_url.py
...ries/0_stateless/01247_insert_into_watch_live_view_url.py
+68
-0
tests/queries/0_stateless/01247_insert_into_watch_live_view_url.reference
...stateless/01247_insert_into_watch_live_view_url.reference
+0
-0
tests/queries/0_stateless/helpers/httpechoserver.py
tests/queries/0_stateless/helpers/httpechoserver.py
+6
-9
tests/queries/0_stateless/helpers/shell.py
tests/queries/0_stateless/helpers/shell.py
+34
-0
未找到文件。
tests/queries/0_stateless/01246_insert_into_watch_live_view.py
0 → 100755
浏览文件 @
72ca3151
#!/usr/bin/env python
import
os
import
sys
import
time
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
,
client
(
name
=
'client2>'
,
log
=
log
)
as
client2
,
client
(
name
=
'client3>'
,
log
=
log
)
as
client3
:
client1
.
expect
(
prompt
)
client2
.
expect
(
prompt
)
client3
.
expect
(
prompt
)
client1
.
send
(
'SET allow_experimental_live_view = 1'
)
client1
.
expect
(
prompt
)
client3
.
send
(
'SET allow_experimental_live_view = 1'
)
client3
.
expect
(
prompt
)
client1
.
send
(
'DROP TABLE IF EXISTS test.lv'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'DROP TABLE IF EXISTS test.mt'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'DROP TABLE IF EXISTS test.sums'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'CREATE LIVE VIEW test.lv AS SELECT sum(a) AS s FROM test.mt'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'CREATE TABLE test.sums (s Int32, version Int32) Engine=MergeTree ORDER BY tuple()'
)
client1
.
expect
(
prompt
)
client3
.
send
(
'CREATE LIVE VIEW test.lv_sums AS SELECT * FROM test.sums ORDER BY version'
)
client3
.
expect
(
prompt
)
client3
.
send
(
"WATCH test.lv_sums FORMAT CSV"
)
client3
.
expect
(
r
'0.*1'
+
end_of_block
)
client1
.
send
(
'INSERT INTO test.sums WATCH test.lv'
)
client1
.
expect
(
end_of_block
)
client3
.
expect
(
'0,1.*
\r\n
'
)
client2
.
send
(
'INSERT INTO test.mt VALUES (1),(2),(3)'
)
client2
.
expect
(
prompt
)
client3
.
expect
(
'6,2.*
\r\n
'
)
client2
.
send
(
'INSERT INTO test.mt VALUES (4),(5),(6)'
)
client2
.
expect
(
prompt
)
client3
.
expect
(
'21,3.*
\r\n
'
)
# send Ctrl-C
client3
.
send
(
'
\x03
'
,
eol
=
''
)
match
=
client3
.
expect
(
'(%s)|([#\$] )'
%
prompt
)
if
match
.
groups
()[
1
]:
client3
.
send
(
client3
.
command
)
client3
.
expect
(
prompt
)
# send Ctrl-C
client1
.
send
(
'
\x03
'
,
eol
=
''
)
match
=
client1
.
expect
(
'(%s)|([#\$] )'
%
prompt
)
if
match
.
groups
()[
1
]:
client1
.
send
(
client1
.
command
)
client1
.
expect
(
prompt
)
client2
.
send
(
'DROP TABLE test.lv'
)
client2
.
expect
(
prompt
)
client2
.
send
(
'DROP TABLE test.lv_sums'
)
client2
.
expect
(
prompt
)
client2
.
send
(
'DROP TABLE test.sums'
)
client2
.
expect
(
prompt
)
client2
.
send
(
'DROP TABLE test.mt'
)
client2
.
expect
(
prompt
)
tests/queries/0_stateless/01246_insert_into_watch_live_view.reference
0 → 100644
浏览文件 @
72ca3151
tests/queries/0_stateless/01247_insert_into_watch_live_view_url.py
0 → 100755
浏览文件 @
72ca3151
#!/usr/bin/env python
import
os
import
sys
import
time
import
signal
import
requests
CURDIR
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
CURDIR
,
'helpers'
))
from
httpechoserver
import
HTTP_SERVER_URL_STR
from
client
import
client
,
prompt
,
end_of_block
from
shell
import
shell
log
=
None
# uncomment the line below for debugging
#log=sys.stdout
for
output_format
in
[
'CSV'
,
'JSONEachRow'
,
'JSONEachRowWithProgress'
]:
with
shell
(
log
=
log
)
as
bash
:
try
:
bash
.
send
(
"python
\"
%s
\"
3"
%
os
.
path
.
join
(
CURDIR
,
'helpers'
,
'httpechoserver.py'
))
bash
.
expect
(
"
\n
+"
)
with
client
(
name
=
'client1>'
,
log
=
log
)
as
client1
,
client
(
name
=
'client2>'
,
log
=
log
)
as
client2
:
client1
.
expect
(
prompt
)
client2
.
expect
(
prompt
)
client1
.
send
(
'SET allow_experimental_live_view = 1'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'DROP TABLE IF EXISTS test.lv'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'DROP TABLE IF EXISTS test.mt'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'CREATE TABLE test.mt (a Int32) Engine=MergeTree order by tuple()'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'CREATE LIVE VIEW test.lv AS SELECT sum(a) AS s FROM test.mt'
)
client1
.
expect
(
prompt
)
client1
.
send
(
"INSERT INTO FUNCTION url('%s', %s, 's Int32, version Int32') WATCH test.lv"
%
(
HTTP_SERVER_URL_STR
,
output_format
))
client1
.
expect
(
end_of_block
)
bash
.
expect
(
"0.*1.*
\r\n
"
)
client2
.
send
(
'INSERT INTO test.mt VALUES (1),(2),(3)'
)
client2
.
expect
(
prompt
)
bash
.
expect
(
"6.*2.*
\r\n
"
)
client2
.
send
(
'INSERT INTO test.mt VALUES (4),(5),(6)'
)
client2
.
expect
(
prompt
)
bash
.
expect
(
"21.*3.*
\r\n
"
)
# send Ctrl-C
client1
.
send
(
'
\x03
'
,
eol
=
''
)
match
=
client1
.
expect
(
'(%s)|([#\$] )'
%
prompt
)
if
match
.
groups
()[
1
]:
client1
.
send
(
client1
.
command
)
client1
.
expect
(
prompt
)
client1
.
send
(
'DROP TABLE test.lv'
)
client1
.
expect
(
prompt
)
client1
.
send
(
'DROP TABLE test.mt'
)
client1
.
expect
(
prompt
)
finally
:
try
:
for
i
in
range
(
3
):
requests
.
post
(
HTTP_SERVER_URL_STR
,
data
=
b
"0
\r\n
"
,
timeout
=
1
)
except
Exception
:
pass
tests/queries/0_stateless/01247_insert_into_watch_live_view_url.reference
0 → 100644
浏览文件 @
72ca3151
tests/queries/0_stateless/helpers/httpechoserver.py
浏览文件 @
72ca3151
...
@@ -20,7 +20,7 @@ HTTP_SERVER_ADDRESS = (HTTP_SERVER_HOST, HTTP_SERVER_PORT)
...
@@ -20,7 +20,7 @@ HTTP_SERVER_ADDRESS = (HTTP_SERVER_HOST, HTTP_SERVER_PORT)
HTTP_SERVER_URL_STR
=
'http://'
+
':'
.
join
(
str
(
s
)
for
s
in
HTTP_SERVER_ADDRESS
)
+
"/"
HTTP_SERVER_URL_STR
=
'http://'
+
':'
.
join
(
str
(
s
)
for
s
in
HTTP_SERVER_ADDRESS
)
+
"/"
ostream
=
StringIO
()
ostream
=
StringIO
()
istream
=
StringIO
()
istream
=
sys
.
stdout
class
EchoCSVHTTPServer
(
BaseHTTPRequestHandler
):
class
EchoCSVHTTPServer
(
BaseHTTPRequestHandler
):
def
_set_headers
(
self
):
def
_set_headers
(
self
):
...
@@ -57,10 +57,8 @@ class EchoCSVHTTPServer(BaseHTTPRequestHandler):
...
@@ -57,10 +57,8 @@ class EchoCSVHTTPServer(BaseHTTPRequestHandler):
chunk
=
self
.
read_chunk
()
chunk
=
self
.
read_chunk
()
if
not
chunk
:
if
not
chunk
:
break
break
pos
=
istream
.
tell
()
istream
.
seek
(
0
,
SEEK_END
)
istream
.
write
(
chunk
)
istream
.
write
(
chunk
)
istream
.
seek
(
pos
)
istream
.
flush
(
)
text
=
""
text
=
""
self
.
_set_headers
()
self
.
_set_headers
()
self
.
wfile
.
write
(
"ok"
)
self
.
wfile
.
write
(
"ok"
)
...
@@ -78,11 +76,10 @@ def start_server(requests_amount, test_data="Hello,2,-2,7.7\nWorld,2,-5,8.8"):
...
@@ -78,11 +76,10 @@ def start_server(requests_amount, test_data="Hello,2,-2,7.7\nWorld,2,-5,8.8"):
httpd
.
handle_request
()
httpd
.
handle_request
()
t
=
threading
.
Thread
(
target
=
real_func
)
t
=
threading
.
Thread
(
target
=
real_func
)
t
.
out
=
istream
return
t
return
t
def
run
():
def
run
(
requests_amount
=
1
):
t
=
start_server
(
1
)
t
=
start_server
(
requests_amount
)
t
.
start
()
t
.
start
()
t
.
join
()
t
.
join
()
...
@@ -90,11 +87,11 @@ if __name__ == "__main__":
...
@@ -90,11 +87,11 @@ if __name__ == "__main__":
exception_text
=
''
exception_text
=
''
for
i
in
range
(
1
,
5
):
for
i
in
range
(
1
,
5
):
try
:
try
:
run
()
run
(
int
(
sys
.
argv
[
1
])
if
len
(
sys
.
argv
)
>
1
else
1
)
break
break
except
Exception
as
ex
:
except
Exception
as
ex
:
exception_text
=
str
(
ex
)
exception_text
=
str
(
ex
)
time
.
sleep
(
0.
1
)
time
.
sleep
(
1
)
if
exception_text
:
if
exception_text
:
print
(
"Exception: {}"
.
format
(
exception_text
),
file
=
sys
.
stderr
)
print
(
"Exception: {}"
.
format
(
exception_text
),
file
=
sys
.
stderr
)
...
...
tests/queries/0_stateless/helpers/shell.py
0 → 100644
浏览文件 @
72ca3151
import
os
import
sys
import
time
CURDIR
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
CURDIR
))
import
uexpect
class
shell
(
object
):
def
__init__
(
self
,
command
=
None
,
name
=
''
,
log
=
None
,
prompt
=
'[#\$] '
):
if
command
is
None
:
command
=
[
'/bin/bash'
,
'--noediting'
]
self
.
prompt
=
prompt
self
.
client
=
uexpect
.
spawn
(
command
)
self
.
client
.
eol
(
'
\r
'
)
self
.
client
.
logger
(
log
,
prefix
=
name
)
self
.
client
.
timeout
(
20
)
self
.
client
.
expect
(
prompt
,
timeout
=
60
)
def
__enter__
(
self
):
io
=
self
.
client
.
__enter__
()
io
.
prompt
=
self
.
prompt
return
io
def
__exit__
(
self
,
type
,
value
,
traceback
):
self
.
client
.
reader
[
'kill_event'
].
set
()
# send Ctrl-C
self
.
client
.
send
(
'
\x03
'
,
eol
=
''
)
time
.
sleep
(
0.3
)
self
.
client
.
send
(
'exit'
,
eol
=
'
\r
'
)
self
.
client
.
send
(
'
\x03
'
,
eol
=
''
)
return
self
.
client
.
__exit__
(
type
,
value
,
traceback
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录