Skip to content

TEST: adopt new rest catalog image and enable tableExists tests #1389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/docker-compose-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
- hive:hive
- minio:minio
rest:
image: tabulario/iceberg-rest
image: apache/iceberg-rest-fixture
container_name: pyiceberg-rest
networks:
iceberg_net:
Expand Down
2 changes: 1 addition & 1 deletion pyiceberg/catalog/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def table_exists(self, identifier: Union[str, Identifier]) -> bool:

if response.status_code == 404:
return False
elif response.status_code == 204:
elif response.status_code in (200, 204):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we upstream this to the spec?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return True

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/catalog/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def test_table_exists_200(rest_mock: Mocker) -> None:
request_headers=TEST_HEADERS,
)
catalog = RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN)
assert not catalog.table_exists(("fokko", "table"))
assert catalog.table_exists(("fokko", "table"))


def test_table_exists_204(rest_mock: Mocker) -> None:
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/test_writes/test_writes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,10 +1368,9 @@ def test_table_v1_with_null_nested_namespace(session_catalog: Catalog, arrow_tab
identifier = "default.lower.table_v1_with_null_nested_namespace"
tbl = _create_table(session_catalog, identifier, {"format-version": "1"}, [arrow_table_with_null])
assert tbl.format_version == 1, f"Expected v1, got: v{tbl.format_version}"
# TODO: Add session_catalog.table_exists check here when we integrate a REST catalog image
# that supports HEAD request on table endpoint

# assert session_catalog.table_exists(identifier)
assert session_catalog.load_table(identifier) is not None
assert session_catalog.table_exists(identifier)

# We expect no error here
session_catalog.drop_table(identifier)
Expand Down
Loading