chia7712 commented on code in PR #17992:
URL: https://github.com/apache/kafka/pull/17992#discussion_r1866426354


##########
tests/docker/ducker-ak:
##########
@@ -489,6 +489,21 @@ EOF
     exec 3>&-
 }
 
+correct_latest_link() {
+    local result_dir="${kafka_dir}/results"
+    local latest_link="${result_dir}/latest"
+    local latest_test_dirname=""
+    local latest_test_dir=""
+
+    # Correct the link if it's a symbolic link and broken.
+    if [[ -L "${latest_link}" ]] && [[ ! -e "${latest_link}" ]]; then
+        latest_test_dirname=$(basename "$(readlink "${latest_link}")")
+        latest_test_dir="${result_dir}/${latest_test_dirname}"
+        unlink "${latest_link}"
+        ln -s "${latest_test_dir}" "${latest_link}"

Review Comment:
   we can just replace `${latest_test_dir}"` by 
`"${result_dir}/${latest_test_dirname}"`



##########
tests/docker/ducker-ak:
##########
@@ -489,6 +489,21 @@ EOF
     exec 3>&-
 }
 
+correct_latest_link() {
+    local result_dir="${kafka_dir}/results"
+    local latest_link="${result_dir}/latest"
+    local latest_test_dirname=""
+    local latest_test_dir=""
+
+    # Correct the link if it's a symbolic link and broken.
+    if [[ -L "${latest_link}" ]] && [[ ! -e "${latest_link}" ]]; then
+        latest_test_dirname=$(basename "$(readlink "${latest_link}")")

Review Comment:
   Maybe we can declare the local variable when we need?
   ```
   local latest_test_dirname=$(basename "$(readlink "${latest_link}")")
   ```



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to