Skip to content

Commit 217d912

Browse files
committed
tests
1 parent e13b11d commit 217d912

File tree

8 files changed

+47
-47
lines changed

8 files changed

+47
-47
lines changed

tests/catalog/integration_test_dynamodb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def test_load_namespace_properties(test_catalog: Catalog, database_name: str) ->
228228
warehouse_location = get_s3_path(get_bucket_name())
229229
test_properties = {
230230
"comment": "this is a test description",
231-
"location": f"{warehouse_location}/{database_name}.db",
231+
"location": f"{warehouse_location}/{database_name}",
232232
"test_property1": "1",
233233
"test_property2": "2",
234234
"test_property3": "3",
@@ -251,7 +251,7 @@ def test_update_namespace_properties(test_catalog: Catalog, database_name: str)
251251
warehouse_location = get_s3_path(get_bucket_name())
252252
test_properties = {
253253
"comment": "this is a test description",
254-
"location": f"{warehouse_location}/{database_name}.db",
254+
"location": f"{warehouse_location}/{database_name}",
255255
"test_property1": "1",
256256
"test_property2": "2",
257257
"test_property3": "3",

tests/catalog/integration_test_glue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def test_load_namespace_properties(test_catalog: Catalog, database_name: str) ->
336336
warehouse_location = get_s3_path(get_bucket_name())
337337
test_properties = {
338338
"comment": "this is a test description",
339-
"location": f"{warehouse_location}/{database_name}.db",
339+
"location": f"{warehouse_location}/{database_name}",
340340
"test_property1": "1",
341341
"test_property2": "2",
342342
"test_property3": "3",
@@ -366,7 +366,7 @@ def test_update_namespace_properties(test_catalog: Catalog, database_name: str)
366366
warehouse_location = get_s3_path(get_bucket_name())
367367
test_properties = {
368368
"comment": "this is a test description",
369-
"location": f"{warehouse_location}/{database_name}.db",
369+
"location": f"{warehouse_location}/{database_name}",
370370
"test_property1": "1",
371371
"test_property2": "2",
372372
"test_property3": "3",

tests/catalog/test_dynamodb.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_create_table_with_database_location(
7171
catalog_name = "test_ddb_catalog"
7272
identifier = (database_name, table_name)
7373
test_catalog = DynamoDbCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
74-
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}.db"})
74+
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}"})
7575
table = test_catalog.create_table(identifier, table_schema_nested)
7676
assert table.name() == identifier
7777
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -88,7 +88,7 @@ def test_create_table_with_pyarrow_schema(
8888
catalog_name = "test_ddb_catalog"
8989
identifier = (database_name, table_name)
9090
test_catalog = DynamoDbCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
91-
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}.db"})
91+
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}"})
9292
table = test_catalog.create_table(identifier, pyarrow_schema_simple_without_ids)
9393
assert table.name() == identifier
9494
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -116,7 +116,7 @@ def test_create_table_with_given_location(
116116
test_catalog = DynamoDbCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
117117
test_catalog.create_namespace(namespace=database_name)
118118
table = test_catalog.create_table(
119-
identifier=identifier, schema=table_schema_nested, location=f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}"
119+
identifier=identifier, schema=table_schema_nested, location=f"s3://{BUCKET_NAME}/{database_name}/{table_name}"
120120
)
121121
assert table.name() == identifier
122122
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -130,7 +130,7 @@ def test_create_table_removes_trailing_slash_in_location(
130130
identifier = (database_name, table_name)
131131
test_catalog = DynamoDbCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
132132
test_catalog.create_namespace(namespace=database_name)
133-
location = f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}"
133+
location = f"s3://{BUCKET_NAME}/{database_name}/{table_name}"
134134
table = test_catalog.create_table(identifier=identifier, schema=table_schema_nested, location=f"{location}/")
135135
assert table.name() == identifier
136136
assert table.location() == location
@@ -155,7 +155,7 @@ def test_create_table_with_strips(
155155
catalog_name = "test_ddb_catalog"
156156
identifier = (database_name, table_name)
157157
test_catalog = DynamoDbCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
158-
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}.db/"})
158+
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}/"})
159159
table = test_catalog.create_table(identifier, table_schema_nested)
160160
assert table.name() == identifier
161161
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -427,7 +427,7 @@ def test_create_namespace_no_properties(_bucket_initialize: None, database_name:
427427

428428
@mock_aws
429429
def test_create_namespace_with_comment_and_location(_bucket_initialize: None, database_name: str) -> None:
430-
test_location = f"s3://{BUCKET_NAME}/{database_name}.db"
430+
test_location = f"s3://{BUCKET_NAME}/{database_name}"
431431
test_properties = {
432432
"comment": "this is a test description",
433433
"location": test_location,
@@ -487,7 +487,7 @@ def test_drop_non_exist_namespace(_bucket_initialize: None, database_name: str)
487487

488488
@mock_aws
489489
def test_load_namespace_properties(_bucket_initialize: None, database_name: str) -> None:
490-
test_location = f"s3://{BUCKET_NAME}/{database_name}.db"
490+
test_location = f"s3://{BUCKET_NAME}/{database_name}"
491491
test_properties = {
492492
"comment": "this is a test description",
493493
"location": test_location,
@@ -514,7 +514,7 @@ def test_load_non_exist_namespace_properties(_bucket_initialize: None, database_
514514
def test_update_namespace_properties(_bucket_initialize: None, database_name: str) -> None:
515515
test_properties = {
516516
"comment": "this is a test description",
517-
"location": f"s3://{BUCKET_NAME}/{database_name}.db",
517+
"location": f"s3://{BUCKET_NAME}/{database_name}",
518518
"test_property1": "1",
519519
"test_property2": "2",
520520
"test_property3": "3",
@@ -547,7 +547,7 @@ def test_load_empty_namespace_properties(_bucket_initialize: None, database_name
547547
def test_update_namespace_properties_overlap_update_removal(_bucket_initialize: None, database_name: str) -> None:
548548
test_properties = {
549549
"comment": "this is a test description",
550-
"location": f"s3://{BUCKET_NAME}/{database_name}.db",
550+
"location": f"s3://{BUCKET_NAME}/{database_name}",
551551
"test_property1": "1",
552552
"test_property2": "2",
553553
"test_property3": "3",

tests/catalog/test_glue.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_create_table_with_database_location(
5757
catalog_name = "glue"
5858
identifier = (database_name, table_name)
5959
test_catalog = GlueCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
60-
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}.db"})
60+
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}"})
6161
table = test_catalog.create_table(identifier, table_schema_nested)
6262
assert table.name() == identifier
6363
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -77,7 +77,7 @@ def test_create_table_with_database_location(
7777
"Parameters": {"iceberg.field.id": "1", "iceberg.field.optional": "true", "iceberg.field.current": "true"},
7878
}
7979

80-
assert storage_descriptor["Location"] == f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}"
80+
assert storage_descriptor["Location"] == f"s3://{BUCKET_NAME}/{database_name}/{table_name}"
8181

8282

8383
@mock_aws
@@ -91,7 +91,7 @@ def test_create_v1_table(
9191
) -> None:
9292
catalog_name = "glue"
9393
test_catalog = GlueCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
94-
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}.db"})
94+
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}"})
9595
table = test_catalog.create_table((database_name, table_name), table_schema_nested, properties={"format-version": "1"})
9696
assert table.format_version == 1
9797

@@ -109,7 +109,7 @@ def test_create_v1_table(
109109
"Parameters": {"iceberg.field.id": "1", "iceberg.field.optional": "true", "iceberg.field.current": "true"},
110110
}
111111

112-
assert storage_descriptor["Location"] == f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}"
112+
assert storage_descriptor["Location"] == f"s3://{BUCKET_NAME}/{database_name}/{table_name}"
113113

114114

115115
@mock_aws
@@ -135,7 +135,7 @@ def test_create_table_with_given_location(
135135
test_catalog = GlueCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
136136
test_catalog.create_namespace(namespace=database_name)
137137
table = test_catalog.create_table(
138-
identifier=identifier, schema=table_schema_nested, location=f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}"
138+
identifier=identifier, schema=table_schema_nested, location=f"s3://{BUCKET_NAME}/{database_name}/{table_name}"
139139
)
140140
assert table.name() == identifier
141141
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -150,7 +150,7 @@ def test_create_table_removes_trailing_slash_in_location(
150150
identifier = (database_name, table_name)
151151
test_catalog = GlueCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
152152
test_catalog.create_namespace(namespace=database_name)
153-
location = f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}"
153+
location = f"s3://{BUCKET_NAME}/{database_name}/{table_name}"
154154
table = test_catalog.create_table(identifier=identifier, schema=table_schema_nested, location=f"{location}/")
155155
assert table.name() == identifier
156156
assert table.location() == location
@@ -173,7 +173,7 @@ def test_create_table_with_pyarrow_schema(
173173
table = test_catalog.create_table(
174174
identifier=identifier,
175175
schema=pyarrow_schema_simple_without_ids,
176-
location=f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}",
176+
location=f"s3://{BUCKET_NAME}/{database_name}/{table_name}",
177177
)
178178
assert table.name() == identifier
179179
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -199,7 +199,7 @@ def test_create_table_with_strips(
199199
catalog_name = "glue"
200200
identifier = (database_name, table_name)
201201
test_catalog = GlueCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url})
202-
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}.db/"})
202+
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}/"})
203203
table = test_catalog.create_table(identifier, table_schema_nested)
204204
assert table.name() == identifier
205205
assert TABLE_METADATA_LOCATION_REGEX.match(table.metadata_location)
@@ -497,7 +497,7 @@ def test_create_namespace_no_properties(_bucket_initialize: None, moto_endpoint_
497497

498498
@mock_aws
499499
def test_create_namespace_with_comment_and_location(_bucket_initialize: None, moto_endpoint_url: str, database_name: str) -> None:
500-
test_location = f"s3://{BUCKET_NAME}/{database_name}.db"
500+
test_location = f"s3://{BUCKET_NAME}/{database_name}"
501501
test_properties = {
502502
"comment": "this is a test description",
503503
"location": test_location,
@@ -557,7 +557,7 @@ def test_drop_non_exist_namespace(_bucket_initialize: None, moto_endpoint_url: s
557557

558558
@mock_aws
559559
def test_load_namespace_properties(_bucket_initialize: None, moto_endpoint_url: str, database_name: str) -> None:
560-
test_location = f"s3://{BUCKET_NAME}/{database_name}.db"
560+
test_location = f"s3://{BUCKET_NAME}/{database_name}"
561561
test_properties = {
562562
"comment": "this is a test description",
563563
"location": test_location,
@@ -584,7 +584,7 @@ def test_load_non_exist_namespace_properties(_bucket_initialize: None, moto_endp
584584
def test_update_namespace_properties(_bucket_initialize: None, moto_endpoint_url: str, database_name: str) -> None:
585585
test_properties = {
586586
"comment": "this is a test description",
587-
"location": f"s3://{BUCKET_NAME}/{database_name}.db",
587+
"location": f"s3://{BUCKET_NAME}/{database_name}",
588588
"test_property1": "1",
589589
"test_property2": "2",
590590
"test_property3": "3",
@@ -628,7 +628,7 @@ def test_update_namespace_properties_overlap_update_removal(
628628
) -> None:
629629
test_properties = {
630630
"comment": "this is a test description",
631-
"location": f"s3://{BUCKET_NAME}/{database_name}.db",
631+
"location": f"s3://{BUCKET_NAME}/{database_name}",
632632
"test_property1": "1",
633633
"test_property2": "2",
634634
"test_property3": "3",
@@ -745,7 +745,7 @@ def test_commit_table_update_schema(
745745
"Type": "int",
746746
"Parameters": {"iceberg.field.id": "18", "iceberg.field.optional": "true", "iceberg.field.current": "true"},
747747
}
748-
assert storage_descriptor["Location"] == f"s3://{BUCKET_NAME}/{database_name}.db/{table_name}"
748+
assert storage_descriptor["Location"] == f"s3://{BUCKET_NAME}/{database_name}/{table_name}"
749749

750750

751751
@mock_aws
@@ -918,7 +918,7 @@ def test_register_table_with_given_location(
918918
identifier = (database_name, table_name)
919919
location = metadata_location
920920
test_catalog = GlueCatalog(catalog_name, **{"s3.endpoint": moto_endpoint_url, "warehouse": f"s3://{BUCKET_NAME}"})
921-
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}.db"})
921+
test_catalog.create_namespace(namespace=database_name, properties={"location": f"s3://{BUCKET_NAME}/{database_name}"})
922922
table = test_catalog.register_table(identifier, location)
923923
assert table.name() == identifier
924924
assert test_catalog.table_exists(identifier) is True

tests/catalog/test_hive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ def test_resolve_table_location_warehouse(hive_database: HiveDatabase) -> None:
12521252
catalog._client.__enter__().get_database.return_value = hive_database
12531253

12541254
location = catalog._resolve_table_location(None, "database", "table")
1255-
assert location == "/tmp/warehouse/database.db/table"
1255+
assert location == "/tmp/warehouse/database/table"
12561256

12571257

12581258
def test_hive_wait_for_lock() -> None:

0 commit comments

Comments
 (0)