Azure: Show disk usage

Collect disk usage information may be helpful, for example, for
debugging code required free space such as healthcheck tests.

Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Stanislav Levin 2021-02-02 17:15:17 +03:00 committed by Florence Blanc-Renaud
parent 3ac2cdfd43
commit 85c63fbe62
3 changed files with 37 additions and 18 deletions

View File

@ -101,14 +101,5 @@ if [ "$install_result" -eq 0 ] ; then
firewalld_cmd --remove-service={freeipa-ldap,freeipa-ldaps,dns}
fi
echo "Report memory statistics"
cat /sys/fs/cgroup/memory/memory.memsw.failcnt
cat /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes
cat /sys/fs/cgroup/memory/memory.memsw.max_usage_in_bytes
cat /sys/fs/cgroup/memory/memory.failcnt
cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes
cat /sys/fs/cgroup/memory/memory.limit_in_bytes
cat /proc/sys/vm/swappiness
# Final result depends on the exit code of the ipa-run-tests
test "$tests_result" -eq 0 -a "$install_result" -eq 0

View File

@ -27,13 +27,4 @@ chmod -R o+rX "$IPA_TESTS_LOGSDIR"
find "$IPA_TESTS_LOGSDIR" -mindepth 1 -maxdepth 1 -not -name '.*' -type d \
-exec tar --remove-files -czf {}.tar.gz {} \;
echo "Report memory statistics"
cat /sys/fs/cgroup/memory/memory.memsw.failcnt
cat /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes
cat /sys/fs/cgroup/memory/memory.memsw.max_usage_in_bytes
cat /sys/fs/cgroup/memory/memory.failcnt
cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes
cat /sys/fs/cgroup/memory/memory.limit_in_bytes
cat /proc/sys/vm/swappiness
exit $tests_result

View File

@ -52,6 +52,28 @@ if [ "$IPA_TESTS_TYPE" == "base" ]; then
IPA_TESTS_REPLICAS="0"
fi
function compose_execute() {
# execute given command within every container of compose
local containers="${PROJECT_ID}_master_1"
# build list of replicas
for i in $(seq 1 1 "$IPA_TESTS_REPLICAS"); do
containers+=" ${PROJECT_ID}_replica_${i}"
done
# build list of clients
for i in $(seq 1 1 "$IPA_TESTS_CLIENTS"); do
containers+=" ${PROJECT_ID}_client_${i}"
done
for container in $containers; do
docker exec -t \
"$container" \
"$@" \
2>&1 | \
sed "s/.*/$container: &/"
done
}
project_dir="${IPA_TESTS_ENV_WORKING_DIR}/${IPA_TESTS_ENV_NAME}"
ln -sfr \
"${IPA_TESTS_DOCKERFILES}/docker-compose.yml" \
@ -104,6 +126,21 @@ tests_result=1
/bin/bash --noprofile --norc \
-eux "$tests_runner" && tests_result=0 ; } || tests_result=$?
echo "Report disk usage"
compose_execute df -h
echo "Report memory statistics"
files="
/sys/fs/cgroup/memory/memory.memsw.failcnt
/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes
/sys/fs/cgroup/memory/memory.memsw.max_usage_in_bytes
/sys/fs/cgroup/memory/memory.failcnt
/sys/fs/cgroup/memory/memory.max_usage_in_bytes
/sys/fs/cgroup/memory/memory.limit_in_bytes
/proc/sys/vm/swappiness
"
compose_execute head -n 1 $files
pushd "$project_dir"
BUILD_REPOSITORY_LOCALPATH="$BUILD_REPOSITORY_LOCALPATH" \
IPA_DOCKER_IMAGE="${IPA_DOCKER_IMAGE:-freeipa-azure-builder}" \