From 80abb99723d6448f2c677f1d0a3a3480e81143ee Mon Sep 17 00:00:00 2001 From: Mikhail Filimonov Date: Tue, 25 Feb 2020 01:51:28 +0100 Subject: [PATCH] adjust dockerfile used in tests to allow odbc roundtrip --- .../0_stateless/01086_odbc_roundtrip.reference | 8 ++++++++ .../queries/0_stateless/01086_odbc_roundtrip.sql | 13 +++++++++++++ docker/test/stateless/Dockerfile | 12 +++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 dbms/tests/queries/0_stateless/01086_odbc_roundtrip.reference create mode 100644 dbms/tests/queries/0_stateless/01086_odbc_roundtrip.sql diff --git a/dbms/tests/queries/0_stateless/01086_odbc_roundtrip.reference b/dbms/tests/queries/0_stateless/01086_odbc_roundtrip.reference new file mode 100644 index 00000000000..2f84fe52456 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01086_odbc_roundtrip.reference @@ -0,0 +1,8 @@ +1 +1 +1 0.1 a я +2 0.2 b ą +3 0.3 c d +1 0.1 a я +2 0.2 b ą +3 0.3 c d diff --git a/dbms/tests/queries/0_stateless/01086_odbc_roundtrip.sql b/dbms/tests/queries/0_stateless/01086_odbc_roundtrip.sql new file mode 100644 index 00000000000..c56ab6f8725 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01086_odbc_roundtrip.sql @@ -0,0 +1,13 @@ +select count() > 1 as ok from (select * from odbc('DSN={ClickHouse DSN (ANSI)}','system','tables')); +select count() > 1 as ok from (select * from odbc('DSN={ClickHouse DSN (Unicode)}','system','tables')); + +DROP DATABASE IF EXISTS test_01086; +CREATE DATABASE test_01086; +USE test_01086; + +CREATE TABLE t (x UInt8, y Float32, z String) ENGINE = Memory; +INSERT INTO t VALUES (1,0.1,'a'),(2,0.2,'b'),(3,0.3,'c'); + +select * from odbc('DSN={ClickHouse DSN (ANSI)}','test_01086','t') ORDER BY x; + +DROP DATABASE test_01086; diff --git a/docker/test/stateless/Dockerfile b/docker/test/stateless/Dockerfile index 35e1639b714..3e0b346184b 100644 --- a/docker/test/stateless/Dockerfile +++ b/docker/test/stateless/Dockerfile @@ -1,6 +1,8 @@ # docker build -t yandex/clickhouse-stateless-test . FROM yandex/clickhouse-deb-builder +ARG odbc_driver_url="https://github.com/ClickHouse/clickhouse-odbc/releases/download/v1.1.3.20200115/clickhouse-odbc-1.1.3-Linux.tar.gz" + RUN apt-get update -y \ && env DEBIAN_FRONTEND=noninteractive \ apt-get install --yes --no-install-recommends \ @@ -27,8 +29,16 @@ RUN apt-get update -y \ gdb \ lsof \ llvm-8 \ - vim + vim \ + unixodbc \ + wget +RUN mkdir -p /tmp/clickhouse-odbc-tmp \ + && wget --quiet -O - ${odbc_driver_url} | tar --strip-components=1 -xz -C /tmp/clickhouse-odbc-tmp \ + && cp /tmp/clickhouse-odbc-tmp/lib64/*.so /usr/local/lib/ \ + && odbcinst -i -d -f /tmp/clickhouse-odbc-tmp/share/doc/clickhouse-odbc/config/odbcinst.ini.sample \ + && odbcinst -i -s -l -f /tmp/clickhouse-odbc-tmp/share/doc/clickhouse-odbc/config/odbc.ini.sample \ + && rm -rf /tmp/clickhouse-odbc-tmp ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone