mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-04 15:40:49 +00:00
Add TestCase for feature/ISSUE-5436
This commit is contained in:
parent
61d33a8d9a
commit
9dc70545c0
0
dbms/tests/integration/test_custom_http/__init__.py
Normal file
0
dbms/tests/integration/test_custom_http/__init__.py
Normal file
@ -0,0 +1,11 @@
|
||||
<yandex>
|
||||
<http_port>8123</http_port>
|
||||
<CustomHTTP>
|
||||
<HTTPMatch>
|
||||
<URL>/${database}/a/${id}/${table}</URL>
|
||||
<QUERY>INSERT INTO ${database:ASTIdentifier}.${table:ASTIdentifier}(id) VALUES</QUERY>
|
||||
<QUERY>SELECT * FROM ${database:ASTIdenfier}.t</QUERY>
|
||||
<QUERY>SELECT * FROM a.${table:ASTIdenfier} WHERE id={id:UInt8}</QUERY>
|
||||
</HTTPMatch>
|
||||
</CustomHTTP>
|
||||
</yandex>
|
31
dbms/tests/integration/test_custom_http/test.py
Normal file
31
dbms/tests/integration/test_custom_http/test.py
Normal file
@ -0,0 +1,31 @@
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
from helpers.test_tools import assert_eq_with_retry
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
node = cluster.add_instance('node', main_configs=['configs/custom_http.xml'])
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def start_cluster():
|
||||
try:
|
||||
cluster.start()
|
||||
node.query('''
|
||||
CREATE DATABASE `test`;
|
||||
|
||||
CREATE TABLE `test`.`test_custom_http` (`id` UInt8) Engine=Memory;
|
||||
''')
|
||||
|
||||
yield cluster
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
def test(started_cluster):
|
||||
node_ip = cluster.get_instance_ip(node)
|
||||
url = 'http://%s:8123/test/a/1/test_custom_http' % node_ip
|
||||
data="(1)"
|
||||
params = {'id':1}
|
||||
response = requests.post(url, params = params, data = data)
|
||||
|
||||
assert response.text == '\n1\n1\n'
|
Loading…
Reference in New Issue
Block a user