7070
7171DEFAULT_SORT_ORDER = SortOrder (SortField (source_id = 2 , transform = IdentityTransform ()))
7272
73+ AVAILABLE_ENGINES = ["DataLakeCatalog" , "Iceberg" ]
74+
7375
7476def list_namespaces ():
7577 response = requests .get (f"{ BASE_URL_LOCAL } /namespaces" )
@@ -120,7 +122,7 @@ def generate_record():
120122
121123
122124def create_clickhouse_iceberg_database (
123- started_cluster , node , name , additional_settings = {}
125+ started_cluster , node , name , additional_settings = {}, engine = 'DataLakeCatalog'
124126):
125127 settings = {
126128 "catalog_type" : "rest" ,
@@ -134,7 +136,7 @@ def create_clickhouse_iceberg_database(
134136 f"""
135137DROP DATABASE IF EXISTS { name } ;
136138SET allow_experimental_database_iceberg=true;
137- CREATE DATABASE { name } ENGINE = DataLakeCatalog ('{ BASE_URL } ', 'minio', '{ minio_secret_key } ')
139+ CREATE DATABASE { name } ENGINE = { engine } ('{ BASE_URL } ', 'minio', '{ minio_secret_key } ')
138140SETTINGS { "," .join ((k + "=" + repr (v ) for k , v in settings .items ()))}
139141 """
140142 )
@@ -180,7 +182,8 @@ def started_cluster():
180182 cluster .shutdown ()
181183
182184
183- def test_list_tables (started_cluster ):
185+ @pytest .mark .parametrize ("engine" , AVAILABLE_ENGINES )
186+ def test_list_tables (started_cluster , engine ):
184187 node = started_cluster .instances ["node1" ]
185188
186189 root_namespace = f"clickhouse_{ uuid .uuid4 ()} "
@@ -211,7 +214,7 @@ def test_list_tables(started_cluster):
211214 for namespace in [namespace_1 , namespace_2 ]:
212215 assert len (catalog .list_tables (namespace )) == 0
213216
214- create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME )
217+ create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME , engine = engine )
215218
216219 tables_list = ""
217220 for table in namespace_1_tables :
@@ -246,7 +249,8 @@ def test_list_tables(started_cluster):
246249 )
247250
248251
249- def test_many_namespaces (started_cluster ):
252+ @pytest .mark .parametrize ("engine" , AVAILABLE_ENGINES )
253+ def test_many_namespaces (started_cluster , engine ):
250254 node = started_cluster .instances ["node1" ]
251255 root_namespace_1 = f"A_{ uuid .uuid4 ()} "
252256 root_namespace_2 = f"B_{ uuid .uuid4 ()} "
@@ -267,7 +271,7 @@ def test_many_namespaces(started_cluster):
267271 for table in tables :
268272 create_table (catalog , namespace , table )
269273
270- create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME )
274+ create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME , engine = engine )
271275
272276 for namespace in namespaces :
273277 for table in tables :
@@ -279,7 +283,8 @@ def test_many_namespaces(started_cluster):
279283 )
280284
281285
282- def test_select (started_cluster ):
286+ @pytest .mark .parametrize ("engine" , AVAILABLE_ENGINES )
287+ def test_select (started_cluster , engine ):
283288 node = started_cluster .instances ["node1" ]
284289
285290 test_ref = f"test_list_tables_{ uuid .uuid4 ()} "
@@ -307,7 +312,7 @@ def test_select(started_cluster):
307312 df = pa .Table .from_pylist (data )
308313 table .append (df )
309314
310- create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME )
315+ create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME , engine = engine )
311316
312317 expected = DEFAULT_CREATE_TABLE .format (CATALOG_NAME , namespace , table_name )
313318 assert expected == node .query (
@@ -319,7 +324,8 @@ def test_select(started_cluster):
319324 )
320325
321326
322- def test_hide_sensitive_info (started_cluster ):
327+ @pytest .mark .parametrize ("engine" , AVAILABLE_ENGINES )
328+ def test_hide_sensitive_info (started_cluster , engine ):
323329 node = started_cluster .instances ["node1" ]
324330
325331 test_ref = f"test_hide_sensitive_info_{ uuid .uuid4 ()} "
@@ -337,6 +343,7 @@ def test_hide_sensitive_info(started_cluster):
337343 node ,
338344 CATALOG_NAME ,
339345 additional_settings = {"catalog_credential" : "SECRET_1" },
346+ engine = engine ,
340347 )
341348 assert "SECRET_1" not in node .query (f"SHOW CREATE DATABASE { CATALOG_NAME } " )
342349
@@ -345,11 +352,13 @@ def test_hide_sensitive_info(started_cluster):
345352 node ,
346353 CATALOG_NAME ,
347354 additional_settings = {"auth_header" : "SECRET_2" },
355+ engine = engine ,
348356 )
349357 assert "SECRET_2" not in node .query (f"SHOW CREATE DATABASE { CATALOG_NAME } " )
350358
351359
352- def test_tables_with_same_location (started_cluster ):
360+ @pytest .mark .parametrize ("engine" , AVAILABLE_ENGINES )
361+ def test_tables_with_same_location (started_cluster , engine ):
353362 node = started_cluster .instances ["node1" ]
354363
355364 test_ref = f"test_tables_with_same_location_{ uuid .uuid4 ()} "
@@ -380,7 +389,7 @@ def record(key):
380389 df = pa .Table .from_pylist (data )
381390 table_2 .append (df )
382391
383- create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME )
392+ create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME , engine = engine )
384393
385394 assert 'aaa\n aaa\n aaa' == node .query (f"SELECT symbol FROM { CATALOG_NAME } .`{ namespace } .{ table_name } `" ).strip ()
386395 assert 'bbb\n bbb\n bbb' == node .query (f"SELECT symbol FROM { CATALOG_NAME } .`{ namespace } .{ table_name_2 } `" ).strip ()
0 commit comments