jerryshao commented on code in PR #14888:
URL: https://github.com/apache/gravitino/pull/14888#discussion_r4537558137


##########
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:
   `PostgreSQLContainer` here is our integration-test wrapper 
(`org.apache.gravitino.integration.test.container.PostgreSQLContainer`), which 
defines `PG_PORT = 5432`. Its `getJdbcUrl(database)` only formats the internal 
IP, port and database name; it adds no query parameters. This change preserves 
those URL components while using the published host/port, which is needed when 
the host JVM cannot route container-internal addresses. The PostgreSQL Domain 
suites compiled and passed (28 tests).



##########
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 uses our MySQL wrapper's existing `MYSQL_PORT` constant. Its 
`getJdbcUrl(database)` returns only 
`jdbc:mysql://<internal-ip>:<port>/<database>`, with no additional query 
parameters. The change replaces only the endpoint with the Testcontainers host 
and mapped port so the host-side test/server process can connect. The MySQL 
Domain suites passed (28 tests).



##########
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:
   The existing `else` branch already handles this: for `DOMAIN`, it sets 
`_parent = None` and `_name = _full_name` (or an empty string for an empty full 
name). JSON deserialization invokes `__post_init__` too. 
`test_domain_privileges_and_role_wire_round_trip` verifies a JSON round trip 
for `Finance/US. East,?&+%`, asserting that the full domain name is preserved 
and the parent is `None`. No additional initialization is needed.



##########
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:
   Agreed that splitting the module could improve maintainability. For this PR, 
the shared fixture and contract tests are reused by the authorization-enabled 
suite, with the endpoint/edge-case matrix already extracted into 
`DomainApiEdgesMixin`. I'll keep the current organization for this change; 
further splitting can be considered separately while preserving test discovery 
and both authorization modes.



-- 
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]

Reply via email to