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() {