2019-07-31 10:22:56 +00:00
import pytest
from helpers . cluster import ClickHouseCluster
cluster = ClickHouseCluster ( __file__ )
2021-06-29 13:01:15 +00:00
node1 = cluster . add_instance ( ' node1 ' )
node2 = cluster . add_instance ( ' node2 ' )
2019-07-31 10:22:56 +00:00
2020-09-16 04:26:10 +00:00
2019-07-31 10:22:56 +00:00
@pytest.fixture ( scope = " module " )
def start_cluster ( ) :
try :
cluster . start ( )
for node in [ node1 , node2 ] :
node . query ( """
CREATE TABLE test_table (
APIKey UInt32 ,
CustomAttributeId UInt64 ,
ProfileIDHash UInt64 ,
DeviceIDHash UInt64 ,
Data String )
ENGINE = SummingMergeTree ( )
ORDER BY ( APIKey , CustomAttributeId , ProfileIDHash , DeviceIDHash , intHash32 ( DeviceIDHash ) )
""" )
yield cluster
finally :
cluster . shutdown ( )
def test_remote ( start_cluster ) :
2020-09-16 04:26:10 +00:00
assert node1 . query (
" SELECT 1 FROM remote( ' node { 1,2} ' , default.test_table) WHERE (APIKey = 137715) AND (CustomAttributeId IN (45, 66)) AND (ProfileIDHash != 0) LIMIT 1 " ) == " "