From 7941e0fcd8d7b8edb303a1661233fd9688c46819 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu Date: Mon, 20 Feb 2023 15:42:40 +0800 Subject: [PATCH 20/53] add crictl timeout and sync for CI Signed-off-by: zhangxiaoyu --- CI/test_cases/container_cases/bigdata_stream.sh | 7 +++++++ CI/test_cases/container_cases/bigdata_stream_runc.sh | 4 ++++ CI/test_cases/helpers.sh | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CI/test_cases/container_cases/bigdata_stream.sh b/CI/test_cases/container_cases/bigdata_stream.sh index 7e74d700..3bfc2d50 100755 --- a/CI/test_cases/container_cases/bigdata_stream.sh +++ b/CI/test_cases/container_cases/bigdata_stream.sh @@ -124,6 +124,7 @@ function test_concurrent_bigdata_stream() pids[${#pids[@]}]=$! done wait ${pids[*]// /|} + sync && sync for index in $(seq 1 5); do ls -l /home/iocopy_stream_data_500M_$index @@ -151,6 +152,7 @@ function test_concurrent_bigdata_stream_without_pty() pids[${#pids[@]}]=$! done wait ${pids[*]// /|} + sync && sync for index in $(seq 1 5); do ls -l /home/iocopy_stream_data_500M_$index @@ -209,6 +211,7 @@ function test_stream_with_stop_client() kill -18 $pid wait $pid + sync && sync ls -l /home/iocopy_stream_data_500M total_size=$(stat -c"%s" /home/iocopy_stream_data_500M) @@ -254,6 +257,7 @@ function test_stream_with_stop_attach() kill -18 $pid wait $exec_pid + sync && sync ls -l /home/iocopy_stream_data_500M total_size=$(stat -c"%s" /home/iocopy_stream_data_500M) @@ -299,6 +303,7 @@ function test_stream_with_stop_lxc_monitor() kill -18 $pid wait $exec_pid + sync && sync ls -l /home/iocopy_stream_data_500M total_size=$(stat -c"%s" /home/iocopy_stream_data_500M) @@ -347,6 +352,7 @@ function test_stream_with_stop_isulad() kill -18 $(cat /var/run/isulad.pid) wait $pid + sync && sync ls -l /home/iocopy_stream_data_500M total_size=$(stat -c"%s" /home/iocopy_stream_data_500M) @@ -397,6 +403,7 @@ function test_stream_with_runc() isula exec -it $RUNCID cat test_500M > /home/iocopy_stream_data_500M [[ $? -ne 0 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - failed to cat bigdata" && ((ret++)) + sync && sync total_size=$(stat -c"%s" /home/iocopy_stream_data_500M) [[ $total_size -ne 524288000 ]] && msg_err "${FUNCNAME[0]}:${LINENO} - stream iocopy loss data" && ((ret++)) diff --git a/CI/test_cases/container_cases/bigdata_stream_runc.sh b/CI/test_cases/container_cases/bigdata_stream_runc.sh index 6933bef0..3a384cd8 100755 --- a/CI/test_cases/container_cases/bigdata_stream_runc.sh +++ b/CI/test_cases/container_cases/bigdata_stream_runc.sh @@ -117,6 +117,7 @@ function test_cat_bigdata() pids[${#pids[@]}]=$! done wait ${pids[*]// /|} + sync && sync for index in $(seq 1 5); do ls -l /home/iocopy_stream_data_500M_$index @@ -144,6 +145,7 @@ function test_cat_bigdata_without_pty() pids[${#pids[@]}]=$! done wait ${pids[*]// /|} + sync && sync for index in $(seq 1 5); do ls -l /home/iocopy_stream_data_500M_$index @@ -173,6 +175,7 @@ function test_stream_with_stop_client() kill -18 $pid wait $pid + sync && sync ls -l /home/iocopy_stream_data_500M total_size=$(stat -c"%s" /home/iocopy_stream_data_500M) @@ -217,6 +220,7 @@ function test_stream_with_stop_isulad() kill -18 $(cat /var/run/isulad.pid) wait $pid + sync && sync ls -l /home/iocopy_stream_data_500M total_size=$(stat -c"%s" /home/iocopy_stream_data_500M) diff --git a/CI/test_cases/helpers.sh b/CI/test_cases/helpers.sh index bba4e7e3..5ea4ff94 100755 --- a/CI/test_cases/helpers.sh +++ b/CI/test_cases/helpers.sh @@ -69,7 +69,10 @@ function testcontainer() { function crictl() { CRICTL=$(which crictl) - "$CRICTL" -i unix:///var/run/isulad.sock -r unix:///var/run/isulad.sock "$@" + # Default timeout is 2s. + # In some high IO testcase, isulad handle CRI request time maybe more than 2s. + # And the crictl will print error message "context deadline exceeded" + "$CRICTL" -i unix:///var/run/isulad.sock -r unix:///var/run/isulad.sock --timeout 5s "$@" } function msg_ok() -- 2.25.1