diff --git a/dw-auto-validate.sh b/dw-auto-validate.sh index 84d8364..5bd0fb6 100755 --- a/dw-auto-validate.sh +++ b/dw-auto-validate.sh @@ -69,7 +69,7 @@ done log() { if [ ${VERBOSE} -eq 1 ]; then - echo ${@} + echo -e "$@" fi } @@ -314,17 +314,23 @@ for devfile_url in "${DEVFILE_URL_LIST[@]}"; do log -e "\n${GREEN}${DEVWORKSPACE_NAME} is Running${NC}" else log -e "\n${YELLOW}${DEVWORKSPACE_NAME} failed to start${NC}" - echo "TEST ${devfile_url} with ${image} FAILED ❌" + echo "TEST ${devfile_url} with ${image} FAILED ❌ (workspace state: ${state}, timed out after ${TIMEOUT}s)" failed_test+=("Devfile '$devfile_url' using image '$image'") continue fi log "Validating ${DEVWORKSPACE_NAME} .." - validate_devworkspace ${devfile_url} - if [ $? -eq 0 ]; then + result=$(validate_devworkspace ${devfile_url}) + rc=$? + if [ ${rc} -eq 0 ]; then echo "TEST ${devfile_url} with ${image} PASSED ✅" ((success_count++)) else - echo "TEST ${devfile_url} with ${image} FAILED ❌" + reason=$(echo "${result}" | grep '^ Reason:' | head -1) + if [ -n "${reason}" ]; then + echo "TEST ${devfile_url} with ${image} FAILED ❌ ${reason# Reason: }" + else + echo "TEST ${devfile_url} with ${image} FAILED ❌" + fi failed_test+=("Devfile '$devfile_url' using image '$image'") fi sleep 1s diff --git a/settings/settings-jetbrains.env b/settings/settings-jetbrains.env index 368070c..7111339 100644 --- a/settings/settings-jetbrains.env +++ b/settings/settings-jetbrains.env @@ -31,7 +31,8 @@ validate_devworkspace() { return 0 else # fail - log $(oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /idea-server/std.out) + echo " Reason: landing page returned HTTP ${response} (expected 200)" + oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /idea-server/std.out return 1 fi } diff --git a/settings/settings-sshd.env b/settings/settings-sshd.env index 668d215..f6c3ec1 100644 --- a/settings/settings-sshd.env +++ b/settings/settings-sshd.env @@ -21,7 +21,7 @@ validate_devworkspace() { oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /tmp/sshd.log &>/dev/null #always quiet this message an rely on return code if [ $? -eq 1 ]; then # fail to cat ssh log file - log "Failed to cat /tmp/sshd.log file on container" + echo " Reason: could not read /tmp/sshd.log from container" return 1 fi res=$(oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /tmp/sshd.log | grep -q 'Server listening on') @@ -30,7 +30,7 @@ validate_devworkspace() { return 0 else # fail - log "Failed to retrieve sucessfull sshd status log in /tmp/sshd.log file on container" + echo " Reason: 'Server listening on' not found in /tmp/sshd.log" return 1 fi } diff --git a/settings/settings-vscode.env b/settings/settings-vscode.env index 33a284e..6c1d5b2 100644 --- a/settings/settings-vscode.env +++ b/settings/settings-vscode.env @@ -21,7 +21,7 @@ validate_devworkspace() { oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /checode/entrypoint-logs.txt &>/dev/null #always quiet this message an rely on return code if [ $? -eq 1 ]; then # fail to cat vscode log file - log "Failed to cat /checode/entrypoint-logs.txt file on container" + echo " Reason: could not read /checode/entrypoint-logs.txt from container" return 1 fi res=$(oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /checode/entrypoint-logs.txt | grep -q 'Extension host agent listening on 3100') @@ -30,8 +30,8 @@ validate_devworkspace() { return 0 else # fail - log "Failed to retrieve sucessfull vscode status log in /checode/entrypoint-logs.txt file on container" - log $(oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /checode/entrypoint-logs.txt) + echo " Reason: 'Extension host agent listening on 3100' not found in /checode/entrypoint-logs.txt" + oc exec -n ${DEVWORKSPACE_NS} ${podName} -c ${mainContainerName} -- cat /checode/entrypoint-logs.txt return 1 fi }