This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 104fa57933d KAFKA-18118 Fix the incorrect soft link of results/latest 
(#17992)
104fa57933d is described below

commit 104fa57933d6831ed3364a26e88fbee2911d27b8
Author: Yung <[email protected]>
AuthorDate: Sun Dec 8 08:14:53 2024 +0800

    KAFKA-18118 Fix the incorrect soft link of results/latest (#17992)
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 tests/docker/ducker-ak | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/docker/ducker-ak b/tests/docker/ducker-ak
index 25a812653f3..82834384761 100755
--- a/tests/docker/ducker-ak
+++ b/tests/docker/ducker-ak
@@ -489,6 +489,18 @@ EOF
     exec 3>&-
 }
 
+correct_latest_link() {
+    local result_dir="${kafka_dir}/results"
+    local latest_link="${result_dir}/latest"
+
+    # Correct the link if it's a symbolic link and broken.
+    if [[ -L "${latest_link}" ]] && [[ ! -e "${latest_link}" ]]; then
+        local latest_test_dirname=$(basename "$(readlink "${latest_link}")")
+        unlink "${latest_link}"
+        ln -s "${result_dir}/${latest_test_dirname}" "${latest_link}"
+    fi
+}
+
 ducker_test() {
     require_commands docker
     docker inspect ducker01 &>/dev/null || \
@@ -529,7 +541,10 @@ ducker_test() {
 
     cmd="cd /opt/kafka-dev && ${ducktape_cmd} --cluster-file 
/opt/kafka-dev/tests/docker/build/cluster.json $test_names $ducktape_args"
     echo "docker exec ducker01 bash -c \"${cmd}\""
-    exec docker exec --user=ducker ducker01 bash -c "${cmd}"
+    docker exec --user=ducker ducker01 bash -c "${cmd}"
+    docker_status=$?
+    correct_latest_link
+    exit "${docker_status}"
 }
 
 ducker_ssh() {

Reply via email to