From 104fa57933d6831ed3364a26e88fbee2911d27b8 Mon Sep 17 00:00:00 2001 From: Yung Date: Sun, 8 Dec 2024 08:14:53 +0800 Subject: [PATCH] KAFKA-18118 Fix the incorrect soft link of results/latest (#17992) Reviewers: Chia-Ping Tsai --- 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 25a812653f375..8283438476196 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() {