Add a test for custom TLD

This commit is contained in:
Azat Khuzhin 2020-12-04 00:11:38 +03:00
parent 916cbd6610
commit 8875767b87
5 changed files with 13534 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<yandex>
<top_level_domains_lists>
<!-- relative to application.path, i.e.:
- /var/lib/clickhouse/ on CI
- $PWD local
-->
<public_suffix_list>public_suffix_list.dat</public_suffix_list>
</top_level_domains_lists>
</yandex>

View File

@ -30,6 +30,7 @@ ln -sf $SRC_PATH/config.d/database_atomic.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/config.d/test_cluster_with_incorrect_pw.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/config.d/logging_no_rotate.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/config.d/tcp_with_proxy.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/config.d/top_level_domains_lists.xml $DEST_SERVER_PATH/config.d/
ln -sf $SRC_PATH/users.d/log_queries.xml $DEST_SERVER_PATH/users.d/
ln -sf $SRC_PATH/users.d/readonly.xml $DEST_SERVER_PATH/users.d/
ln -sf $SRC_PATH/users.d/access_management.xml $DEST_SERVER_PATH/users.d/
@ -41,6 +42,12 @@ ln -sf $SRC_PATH/strings_dictionary.xml $DEST_SERVER_PATH/
ln -sf $SRC_PATH/decimals_dictionary.xml $DEST_SERVER_PATH/
ln -sf $SRC_PATH/executable_dictionary.xml $DEST_SERVER_PATH/
# For CI when it is runned via init service
mkdir -p /var/lib/clickhouse/cores
ln -sf $SRC_PATH/public_suffix_list.dat /var/lib/clickhouse/cores/
# For fasttest, that runs server just in background
ln -sf $SRC_PATH/public_suffix_list.dat ./
ln -sf $SRC_PATH/server.key $DEST_SERVER_PATH/
ln -sf $SRC_PATH/server.crt $DEST_SERVER_PATH/
ln -sf $SRC_PATH/dhparam.pem $DEST_SERVER_PATH/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
no-tld
foo.there-is-no-such-domain
foo.there-is-no-such-domain
foo
generic
kernel
kernel.biz.ss
difference
biz.ss
kernel.biz.ss

View File

@ -0,0 +1,16 @@
select 'no-tld';
select cutToFirstSignificantSubdomainCustom('there-is-no-such-domain', 'public_suffix_list');
-- even if there is no TLD, 2-nd level by default anyway
-- FIXME: make this behavior optional (so that TLD for host never changed, either empty or something real)
select cutToFirstSignificantSubdomainCustom('foo.there-is-no-such-domain', 'public_suffix_list');
select cutToFirstSignificantSubdomainCustom('bar.foo.there-is-no-such-domain', 'public_suffix_list');
select firstSignificantSubdomainCustom('bar.foo.there-is-no-such-domain', 'public_suffix_list');
select 'generic';
select firstSignificantSubdomainCustom('foo.kernel.biz.ss', 'public_suffix_list'); -- kernel.biz.ss
select cutToFirstSignificantSubdomainCustom('foo.kernel.biz.ss', 'public_suffix_list'); -- kernel.biz.ss
select 'difference';
-- biz.ss is not in the default TLD list, hence:
select cutToFirstSignificantSubdomain('foo.kernel.biz.ss'); -- biz.ss
select cutToFirstSignificantSubdomainCustom('foo.kernel.biz.ss', 'public_suffix_list'); -- kernel.biz.ss