Copilot commented on code in PR #14888:
URL: https://github.com/apache/gravitino/pull/14888#discussion_r4537362522
##########
clients/client-python/gravitino/dto/authorization/securable_object_dto.py:
##########
@@ -54,7 +54,11 @@ class SecurableObjectDTO(SecurableObject):
)
def __post_init__(self):
- if self._full_name and "." in self._full_name:
+ if (
+ self._type != MetadataObject.Type.DOMAIN
+ and self._full_name
+ and "." in self._full_name
+ ):
index = self._full_name.rfind(".")
self._parent = self._full_name[:index]
self._name = self._full_name[index + 1 :]
Review Comment:
For `MetadataObject.Type.DOMAIN`, this now skips deriving `_name`/`_parent`
from `_full_name`. If any construction path (including JSON deserialization)
provides only `_full_name` for DOMAIN, `name()` may remain unset/empty. A safer
approach is to explicitly set `_name = _full_name` (and `_parent = None`) when
`_type` is DOMAIN and `_name` is missing, while keeping the no-dot-splitting
behavior.
##########
integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/BaseIT.java:
##########
@@ -298,7 +304,13 @@ public String startAndInitMySQLBackend() {
containerSuite.startMySQLContainer(META_DATA);
MYSQL_CONTAINER = containerSuite.getMySQLContainer();
- String mysqlUrl = MYSQL_CONTAINER.getJdbcUrl(META_DATA);
+ // Use published ports for metadata-store connections from the host JVM.
+ String mysqlUrl =
+ String.format(
+ "jdbc:mysql://%s:%d/%s",
+ MYSQL_CONTAINER.getContainer().getHost(),
+ MYSQL_CONTAINER.getMappedPort(MySQLContainer.MYSQL_PORT),
+ META_DATA);
Review Comment:
This rebuilds JDBC URLs manually and risks (1) using a nonexistent
Testcontainers constant (`PostgreSQLContainer.PG_PORT` is typically
`POSTGRESQL_PORT`) and (2) dropping important query parameters that
`getJdbcUrl(...)` may have included (e.g., SSL/timezone/driver flags). Consider
deriving from the container-provided JDBC URL and only replacing host/port (or
use the container’s `getHost()` + correct port constant + preserved query
string) to avoid connection regressions and compilation failures.
##########
integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/BaseIT.java:
##########
@@ -247,7 +247,13 @@ public String startAndInitPGBackend() {
containerSuite.startPostgreSQLContainer(META_DATA);
POSTGRESQL_CONTAINER = containerSuite.getPostgreSQLContainer();
- String pgUrlWithoutSchema = POSTGRESQL_CONTAINER.getJdbcUrl(META_DATA);
+ // The embedded server runs on the test host, which may not route
container-internal IPs.
+ String pgUrlWithoutSchema =
+ String.format(
+ "jdbc:postgresql://%s:%d/%s",
+ POSTGRESQL_CONTAINER.getContainer().getHost(),
+ POSTGRESQL_CONTAINER.getMappedPort(PostgreSQLContainer.PG_PORT),
+ META_DATA);
Review Comment:
This rebuilds JDBC URLs manually and risks (1) using a nonexistent
Testcontainers constant (`PostgreSQLContainer.PG_PORT` is typically
`POSTGRESQL_PORT`) and (2) dropping important query parameters that
`getJdbcUrl(...)` may have included (e.g., SSL/timezone/driver flags). Consider
deriving from the container-provided JDBC URL and only replacing host/port (or
use the container’s `getHost()` + correct port constant + preserved query
string) to avoid connection regressions and compilation failures.
##########
clients/client-python/tests/integration/test_domain.py:
##########
@@ -0,0 +1,1100 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import threading
+from http.client import HTTPConnection
+from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
+from urllib.parse import urlsplit
+import shutil
+import tempfile
+import uuid
+from unittest.mock import patch
+
+from gravitino import Catalog, GravitinoAdminClient, GravitinoClient,
NameIdentifier
+from gravitino.api.authorization.owner import Owner
+from gravitino.api.authorization.privileges import Privileges
+from gravitino.api.authorization.securable_objects import SecurableObjects
+from gravitino.api.domain import (
+ Domain,
+ DomainChange,
+ DomainMemberFilter,
+ DomainRelation,
+)
+from gravitino.api.file.fileset import Fileset
+from gravitino.api.metadata_object import MetadataObject
+from gravitino.api.metadata_objects import MetadataObjects
+from gravitino.api.rel.column import Column
+from gravitino.api.rel.sql_representation import SQLRepresentation
+from gravitino.api.rel.types.types import Types
+from gravitino.api.semantic.dataset import Dataset
+from gravitino.api.semantic.semantic_model_definition import
SemanticModelDefinition
+from gravitino.api.tag import TagValue
+from gravitino.api.tag.tag_change import TagChange
+from gravitino.auth.simple_auth_provider import SimpleAuthProvider
+from gravitino.client.metadata_object_domain_operations import (
+ MetadataObjectDomainOperations,
+)
+from gravitino.exceptions.base import (
+ BackingTagAlreadyBoundException,
+ DomainAlreadyExistsException,
+ ForbiddenException,
+ IllegalArgumentException,
+ NoSuchDomainException,
+ NoSuchTagException,
+ NonEmptyDomainException,
+ TagAlreadyExistsException,
+)
+
+from tests.integration.integration_test_env import IntegrationTestEnv
+from tests.integration.domain_api_edges_mixin import DomainApiEdgesMixin
+
+
+class TestDomain(DomainApiEdgesMixin, IntegrationTestEnv):
+ """Domain SDK tests using the standard Python integration server
lifecycle."""
Review Comment:
This new integration test module is very large (~1100 lines in this PR),
which tends to increase merge conflicts and make failures harder to triage.
Consider splitting it into multiple focused test modules/classes (e.g.,
lifecycle/hierarchy, membership/relations, auth-only behaviors, proxy/encoding,
unicode/value semantics) while keeping shared helpers in the mixin.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]