Add TestCase for feature/ISSUE-5436

This commit is contained in:
tai 2019-11-05 17:46:17 +08:00 committed by zhang2014
parent 61d33a8d9a
commit 9dc70545c0
3 changed files with 42 additions and 0 deletions

View 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>

View 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'