Fixed 00921_datetime64_compatibility.python test case

Running it correctly so test runner does not report failure on intended exceptions.
This commit is contained in:
Vasily Nemkov 2019-11-07 13:58:16 +03:00
parent 3ea467d34a
commit 93afa6f2f3
3 changed files with 1430 additions and 12 deletions

View File

@ -178,19 +178,15 @@ def escape_string(s):
def execute_functions_for_types(functions, types): def execute_functions_for_types(functions, types):
# TODO: use string.Template here to allow lines that do not contain type, like: SELECT CAST(toDateTime64(1234567890), 'DateTime64') # TODO: use string.Template here to allow lines that do not contain type, like: SELECT CAST(toDateTime64(1234567890), 'DateTime64')
for func in functions: for func in functions:
print("""SELECT 'SELECT {func}'""".format(func=escape_string(func))) # for debug only print("""SELECT 'SELECT {func}';""".format(func=escape_string(func)))
for dt in types: for dt in types:
prologue = "\ prologue = "\
WITH \ WITH \
toDateTime64('2019-09-16 19:20:11.234', 3, 'Europe/Minsk') as DT64, \ toDateTime64('2019-09-16 19:20:11.234', 3, 'Europe/Minsk') as DT64, \
toDateTime('2019-09-16 19:20:11', 'Europe/Minsk') as DT, \ toDateTime('2019-09-16 19:20:11', 'Europe/Minsk') as DT, \
toDate('2019-09-16') as D, {X} as N".format(X=dt) toDate('2019-09-16') as D, {X} as N".format(X=dt)
# dt64 = func.format(datetime=dt) print("""{prologue} SELECT toTypeName(r), {func} as r FORMAT CSV;""".format(prologue=prologue, func=func))
# f = "'values match:', ({dt32}) == ({dt64}), 'types match:', toTypeName({dt32}) == toTypeName({dt64})".format(dt32=dt32, dt64=dt64) print("""SELECT '------------------------------------------';""")
print("""{prologue} SELECT toTypeName(r), {func} as r FORMAT CSV""".format(prologue=prologue, func=func))
# print("""SELECT toTypeName(r), {dt64} as r""".format(dt64=dt64)) # for debug only
# print("""SELECT {f};""".format(f=f))
print("""SELECT '------------------------------------------'""") # for debug only
def main(): def main():
def parse_args(): def parse_args():

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL="none"
# We should have correct env vars from shell_config.sh to run this test # We should have correct env vars from shell_config.sh to run this test
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh . $CURDIR/../shell_config.sh
export CH_C_SETTINGS='--format_custom_field_delimiter=\ --format_custom_row_before_delimiter= --format_custom_row_between_delimiter= --format_custom_result_before_delimiter= --format_custom_result_after_delimiter=' # In order to check queries individually (don't stop on the first one that fails):
# in order to check queries individually (does not stop on the first one that fails): #IFS=$'\n'; for I in $(${CURDIR}/00921_datetime64_compatibility.python) ; do unset IFS; ${CLICKHOUSE_CLIENT} --query "${I}"; echo ; done 2>&1;
IFS=$'\n'; for I in $($CURDIR/00921_datetime64_compatibility.python) ; do "${CLICKHOUSE_CLIENT}" -nm -q "$I" $CH_C_SETTINGS; echo ; done 2>&1 \
| tr "\n" "\t" \ # ${CURDIR}/00921_datetime64_compatibility.python
| sed -Eu 's/-------+\t+/\n/g; s/Received exception from server \(version 19.16.1\):\s+//g; s/DB::Exception: Received from localhost:9000. //g; s/\s+$//g; '
${CURDIR}/00921_datetime64_compatibility.python \
| ${CLICKHOUSE_CLIENT} --ignore-error -T -nm --calculate_text_stack_trace 0 --log-level 'error' 2>&1 \
| sed -Ee 's/Received exception from server .*//g; s/(Code: [0-9]+). DB::Exception: Received from .* DB::Exception/\1/g'