mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 12:44:39 +00:00
metrics: Add check containers are up in common script
This PR adds check containers are up in common script for kata metrics. Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
parent
d3e57cf454
commit
1c84680d8c
@ -383,3 +383,17 @@ function collect_results() {
|
|||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_containers_are_up() {
|
||||||
|
local NUM_CONTAINERS="$1"
|
||||||
|
[[ -z ${NUM_CONTAINERS} ]] && die "Number of containers is missing"
|
||||||
|
|
||||||
|
local TIMEOUT=60
|
||||||
|
local containers_launched=0
|
||||||
|
for i in $(seq "${TIMEOUT}") ; do
|
||||||
|
info "Verify that the containers are running"
|
||||||
|
containers_launched="$(sudo ${CTR_EXE} t list | grep -c "RUNNING")"
|
||||||
|
[ "${containers_launched}" -eq "${NUM_CONTAINERS}" ] && break
|
||||||
|
sleep 1
|
||||||
|
[ "${i}" == "${TIMEOUT}" ] && return 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user