Skip to content

Commit 2c616fc

Browse files
committed
add test
1 parent 72f0ade commit 2c616fc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/integration/test_catalog.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
import os
19+
import uuid
1920
from collections.abc import Generator
2021
from pathlib import Path, PosixPath
2122

@@ -601,3 +602,36 @@ def test_register_table_existing(test_catalog: Catalog, table_schema_nested: Sch
601602
# Assert that registering the table again raises TableAlreadyExistsError
602603
with pytest.raises(TableAlreadyExistsError):
603604
test_catalog.register_table(identifier, metadata_location=table.metadata_location)
605+
606+
607+
@pytest.mark.integration
608+
def test_rest_custom_namespace_separator(rest_catalog: Catalog, table_schema_simple: Schema):
609+
"""
610+
Tests that the REST catalog correctly picks up the namespace-separator from the config endpoint.
611+
The REST Catalog is configured with a '.' namespace separator.
612+
"""
613+
assert rest_catalog._namespace_separator == "."
614+
615+
unique_id = uuid.uuid4().hex
616+
parent_namespace = (f"test_parent_{unique_id}",)
617+
child_namespace_part = "child"
618+
full_namespace_tuple = (*parent_namespace, child_namespace_part)
619+
620+
table_name = "my_table"
621+
full_table_identifier_tuple = (*full_namespace_tuple, table_name)
622+
623+
rest_catalog.create_namespace(namespace=parent_namespace)
624+
rest_catalog.create_namespace(namespace=full_namespace_tuple)
625+
626+
namespaces = rest_catalog.list_namespaces(parent_namespace)
627+
assert full_namespace_tuple in namespaces
628+
629+
# Test with a table
630+
table = rest_catalog.create_table(identifier=full_table_identifier_tuple, schema=table_schema_simple)
631+
assert table.identifier == full_table_identifier_tuple
632+
633+
tables = rest_catalog.list_tables(full_namespace_tuple)
634+
assert full_table_identifier_tuple in tables
635+
636+
loaded_table = rest_catalog.load_table(identifier=full_table_identifier_tuple)
637+
assert loaded_table.identifier == full_table_identifier_tuple

0 commit comments

Comments
 (0)