Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add error message when wait file exist timeout #1224

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion hack/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function util::wait_for_condition() {
local timeout=${3:-}

local start_msg="Waiting for ${msg}"
local error_msg="[ERROR] Timeout waiting for ${msg}"
local error_msg="[ERROR] Timeout waiting for condition ${msg}"

local counter=0
while ! eval ${condition}; do
Expand Down Expand Up @@ -251,12 +251,14 @@ function util::wait_for_condition() {
function util::wait_file_exist() {
local file_path=${1}
local timeout=${2}
local error_msg="[ERROR] Timeout waiting for file exist ${file_path}"
for ((time=0; time<${timeout}; time++)); do
if [[ -e ${file_path} ]]; then
return 0
fi
sleep 1
done
echo -e "\n${error_msg}"
return 1
}

Expand Down