Skip to content

Commit 4167dc7

Browse files
committed
tests: add basic test for clickhouse-extract-from-config
1 parent 6df7192 commit 4167dc7

5 files changed

+38
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
xml
2+
Not found: merge_tree.anything_xml
3+
4+
yaml
5+
Not found: merge_tree.anything_yaml
6+
7+
File not found: I hope such path will never exists, since it does not even contain a single slash
8+
I hope such path will never exists, since it does not even contain a single slash
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
4+
# shellcheck source=../shell_config.sh
5+
. "$CUR_DIR"/../shell_config.sh
6+
7+
# NOTE: Cannot use CLICKHOUSE_EXTRACT_CONFIG, since it uses default config.
8+
9+
prefix=$CUR_DIR/"$(basename "${BASH_SOURCE[0]}" .sh)"
10+
11+
$CLICKHOUSE_BINARY extract-from-config --key merge_tree.comment --config $prefix.xml
12+
$CLICKHOUSE_BINARY extract-from-config --key merge_tree.anything_xml --config $prefix.xml |& grep -o 'Not found: merge_tree.anything_xml'
13+
$CLICKHOUSE_BINARY extract-from-config --key merge_tree.anything_xml --config $prefix.xml --try
14+
15+
$CLICKHOUSE_BINARY extract-from-config --key merge_tree.comment --config $prefix.yaml
16+
$CLICKHOUSE_BINARY extract-from-config --key merge_tree.anything_yaml --config $prefix.yaml |& grep -o 'Not found: merge_tree.anything_yaml'
17+
$CLICKHOUSE_BINARY extract-from-config --key merge_tree.anything_yaml --config $prefix.yaml --try
18+
19+
$CLICKHOUSE_BINARY extract-from-config --key include_from --config ${prefix}_bad_include_from.xml |& grep -o 'File not found: I hope such path will never exists, since it does not even contain a single slash'
20+
$CLICKHOUSE_BINARY extract-from-config --key include_from --config ${prefix}_bad_include_from.xml --try
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<clickhouse>
2+
<merge_tree>
3+
<comment>xml</comment>
4+
</merge_tree>
5+
</clickhouse>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
merge_tree:
2+
comment: yaml
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<clickhouse>
2+
<include_from>I hope such path will never exists, since it does not even contain a single slash</include_from>
3+
</clickhouse>

0 commit comments

Comments
 (0)