Merge pull request #31250 from ClickHouse/kssenii-fix-test-1

Fix test
This commit is contained in:
Kseniia Sumarokova 2021-11-11 01:03:21 +03:00 committed by GitHub
commit 852be4b6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import os
import pytest import pytest
from helpers.cluster import ClickHouseCluster from helpers.cluster import ClickHouseCluster
from pyhdfs import HdfsClient
cluster = ClickHouseCluster(__file__) cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', with_hdfs=True) node1 = cluster.add_instance('node1', with_hdfs=True)
@ -238,11 +239,21 @@ def test_virtual_columns(started_cluster):
def test_read_files_with_spaces(started_cluster): def test_read_files_with_spaces(started_cluster):
hdfs_api = started_cluster.hdfs_api hdfs_api = started_cluster.hdfs_api
hdfs_api.write_data("/test test test 1.txt", "1\n") fs = HdfsClient(hosts=started_cluster.hdfs_ip)
hdfs_api.write_data("/test test test 2.txt", "2\n") dir = '/test_spaces'
hdfs_api.write_data("/test test test 3.txt", "3\n") exists = fs.exists(dir)
node1.query("create table test (id UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/test*', 'TSV')") if exists:
fs.delete(dir, recursive=True)
fs.mkdirs(dir)
hdfs_api.write_data(f"{dir}/test test test 1.txt", "1\n")
hdfs_api.write_data(f"{dir}/test test test 2.txt", "2\n")
hdfs_api.write_data(f"{dir}/test test test 3.txt", "3\n")
node1.query(f"create table test (id UInt32) ENGINE = HDFS('hdfs://hdfs1:9000/{dir}/test*', 'TSV')")
assert node1.query("select * from test order by id") == "1\n2\n3\n" assert node1.query("select * from test order by id") == "1\n2\n3\n"
fs.delete(dir, recursive=True)
def test_truncate_table(started_cluster): def test_truncate_table(started_cluster):