github-actions[bot] commented on code in PR #65281:
URL: https://github.com/apache/doris/pull/65281#discussion_r3534148735


##########
regression-test/suites/external_table_p0/iceberg/test_iceberg_deletion_vector.groovy:
##########
@@ -42,30 +42,327 @@ suite("test_iceberg_deletion_vector", "p0,external") {
 
     sql """switch ${catalog_name};"""
     sql """ use format_v3;"""
+    sql """ set file_split_size=1;"""
 
+    try {
+    def executeCommandWithStatus = { String cmd, int timeoutSeconds = 300, 
Boolean logFailure = true,
+            Boolean logCommand = true ->
+        StringBuilder stdout = new StringBuilder()
+        StringBuilder stderr = new StringBuilder()
+        try {
+            if (logCommand) {
+                logger.info("execute ${cmd}")
+            }
+            def proc = new ProcessBuilder("/bin/bash", "-c", cmd).start()
+            proc.consumeProcessOutput(stdout, stderr)
+            proc.waitForOrKill(timeoutSeconds * 1000)
+            int exitcode = proc.exitValue()
+            String output = stdout.toString()
+            String error = stderr.toString()
+            if (exitcode != 0 && logFailure) {
+                logger.info("exit code: ${exitcode}, stdout\n: 
${output}\nstderr\n: ${error}")
+            }
+            return [exitCode: exitcode, stdout: output, stderr: error]
+        } catch (IOException e) {
+            assertTrue(false, "Execute failed: ${cmd}, err: ${e.message}")
+        }
+    }
+
+    def executeCommand = { String cmd, Boolean mustSuc, int timeoutSeconds = 
300 ->
+        def result = executeCommandWithStatus(cmd, timeoutSeconds)
+        if (mustSuc && result.exitCode != 0) {
+            assertTrue(false,
+                    "Execute failed: 
${cmd}\nstdout:\n${result.stdout}\nstderr:\n${result.stderr}")
+        }
+        return result.stdout
+    }
+
+    String dockerCommand = 
context.config.otherConfigs.get("externalDockerCommand") ?: "docker"
+    def listDockerContainers = {
+        String containers =
+                executeCommand("${dockerCommand} ps --format 
'{{.ID}}\t{{.Names}}\t{{.Image}}'", true, 30) ?:
+                        ""
+        return containers.readLines().collect { it.trim() }.findAll { 
!it.isEmpty() }
+    }
+
+    def findRequiredDockerContainer = { String role, String configKey, String 
probeCommand ->
+        String configuredContainer = context.config.otherConfigs.get(configKey)
+        if (configuredContainer != null && !configuredContainer.isEmpty()) {
+            def probe = executeCommandWithStatus(
+                    "${dockerCommand} exec ${configuredContainer} bash -lc 
'${probeCommand}'",
+                    30)
+            assertEquals(0, probe.exitCode,
+                    "${role} container configured by 
${configKey}=${configuredContainer} is not usable")
+            return configuredContainer
+        }
+
+        def matchedContainers = []
+        listDockerContainers().each { String containerLine ->
+            def fields = containerLine.split(/\t/, 3)
+            assertTrue(fields.length >= 2, "Unexpected docker ps output: 
${containerLine}")
+            String containerId = fields[0].trim()
+            String containerName = fields[1].trim()
+            String containerImage = fields.length >= 3 ? fields[2].trim() : ""
+            def probe = executeCommandWithStatus(
+                    "${dockerCommand} exec ${containerId} bash -lc 
'${probeCommand}'",
+                    30,
+                    false,
+                    false)
+            if (probe.exitCode == 0) {
+                matchedContainers.add(
+                        [id: containerId, name: containerName, image: 
containerImage])
+            }
+        }
+
+        assertFalse(matchedContainers.isEmpty(),
+                "No usable ${role} container found. Set ${configKey} to the 
exact container name " +
+                        "or start the required external environment.")
+        assertEquals(1, matchedContainers.size(),
+                "Multiple usable ${role} containers found: 
${matchedContainers}. " +
+                        "Set ${configKey} to the exact container name.")
+        logger.info("use ${role} container ${matchedContainers[0].name} " +
+                "(${matchedContainers[0].image})")
+        return matchedContainers[0].id
+    }
+
+    String sparkContainerName = findRequiredDockerContainer(

Review Comment:
   This Spark discovery probe is too broad for the normal full external 
environment. `run-thirdparties-docker.sh` starts both Iceberg and Hudi by 
default, and both `doris--spark-iceberg` and the Hudi `hudi-spark` container 
provide `spark-sql`, so probing every container with only `command -v 
spark-sql` can make `findRequiredDockerContainer` collect multiple matches and 
fail at `assertEquals(1, matchedContainers.size())` before any DV assertion 
runs. Please constrain this to the Iceberg Spark service/config, or probe for 
Iceberg-specific catalog/runtime state instead of generic Spark availability.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to