mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Add a test
This commit is contained in:
parent
9f4041e3f7
commit
b916479025
1
programs/server/config.d/handlers.yaml
Symbolic link
1
programs/server/config.d/handlers.yaml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../tests/config/config.d/handlers.yaml
|
8
tests/config/config.d/handlers.yaml
Normal file
8
tests/config/config.d/handlers.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
http_handlers:
|
||||||
|
rule:
|
||||||
|
url: '/upyachka'
|
||||||
|
empty_query_string:
|
||||||
|
handler:
|
||||||
|
type: redirect
|
||||||
|
location: "/?query=SELECT+'Pepyaka'"
|
||||||
|
defaults:
|
@ -66,6 +66,7 @@ ln -sf $SRC_PATH/config.d/filesystem_caches_path.xml $DEST_SERVER_PATH/config.d/
|
|||||||
ln -sf $SRC_PATH/config.d/validate_tcp_client_information.xml $DEST_SERVER_PATH/config.d/
|
ln -sf $SRC_PATH/config.d/validate_tcp_client_information.xml $DEST_SERVER_PATH/config.d/
|
||||||
ln -sf $SRC_PATH/config.d/zero_copy_destructive_operations.xml $DEST_SERVER_PATH/config.d/
|
ln -sf $SRC_PATH/config.d/zero_copy_destructive_operations.xml $DEST_SERVER_PATH/config.d/
|
||||||
ln -sf $SRC_PATH/config.d/block_number.xml $DEST_SERVER_PATH/config.d/
|
ln -sf $SRC_PATH/config.d/block_number.xml $DEST_SERVER_PATH/config.d/
|
||||||
|
ln -sf $SRC_PATH/config.d/handlers.yaml $DEST_SERVER_PATH/config.d/
|
||||||
|
|
||||||
# Not supported with fasttest.
|
# Not supported with fasttest.
|
||||||
if [ "${DEST_SERVER_PATH}" = "/etc/clickhouse-server" ]
|
if [ "${DEST_SERVER_PATH}" = "/etc/clickhouse-server" ]
|
||||||
|
5
tests/queries/0_stateless/02998_http_redirects.reference
Normal file
5
tests/queries/0_stateless/02998_http_redirects.reference
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Ok.
|
||||||
|
HTTP/1.1 302 Found
|
||||||
|
Location: /?query=SELECT+'Pepyaka'
|
||||||
|
HTTP/1.1 404 Not Found
|
||||||
|
Pepyaka
|
19
tests/queries/0_stateless/02998_http_redirects.sh
Executable file
19
tests/queries/0_stateless/02998_http_redirects.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
|
# shellcheck source=../shell_config.sh
|
||||||
|
. "$CUR_DIR"/../shell_config.sh
|
||||||
|
|
||||||
|
URL="${CLICKHOUSE_PORT_HTTP_PROTO}://${CLICKHOUSE_HOST}:${CLICKHOUSE_PORT_HTTP}"
|
||||||
|
|
||||||
|
# Ping handler
|
||||||
|
${CLICKHOUSE_CURL} -s -S "${URL}/"
|
||||||
|
|
||||||
|
# A handler that is configured to return a redirect
|
||||||
|
${CLICKHOUSE_CURL} -s -S -I "${URL}/upyachka" | grep -i -P '^HTTP|Location'
|
||||||
|
|
||||||
|
# This handler is configured to not accept any query string
|
||||||
|
${CLICKHOUSE_CURL} -s -S -I "${URL}/upyachka?hello=world" | grep -i -P '^HTTP|Location'
|
||||||
|
|
||||||
|
# Check that actual redirect works
|
||||||
|
${CLICKHOUSE_CURL} -s -S -L "${URL}/upyachka"
|
Loading…
Reference in New Issue
Block a user