From 85c63fbe62618fdbc5b13ce0aa47f2d478de5eac Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Tue, 2 Feb 2021 17:15:17 +0300 Subject: [PATCH] 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 Reviewed-By: Alexander Bokovoy --- .../azure/scripts/azure-run-base-tests.sh | 9 ----- .../scripts/azure-run-integration-tests.sh | 9 ----- ipatests/azure/scripts/azure-run-tests.sh | 37 +++++++++++++++++++ 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/ipatests/azure/scripts/azure-run-base-tests.sh b/ipatests/azure/scripts/azure-run-base-tests.sh index c779fbc89..7b538671e 100755 --- a/ipatests/azure/scripts/azure-run-base-tests.sh +++ b/ipatests/azure/scripts/azure-run-base-tests.sh @@ -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 diff --git a/ipatests/azure/scripts/azure-run-integration-tests.sh b/ipatests/azure/scripts/azure-run-integration-tests.sh index 50006d063..0a08c2e00 100755 --- a/ipatests/azure/scripts/azure-run-integration-tests.sh +++ b/ipatests/azure/scripts/azure-run-integration-tests.sh @@ -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 diff --git a/ipatests/azure/scripts/azure-run-tests.sh b/ipatests/azure/scripts/azure-run-tests.sh index ea8f93646..b549e6271 100755 --- a/ipatests/azure/scripts/azure-run-tests.sh +++ b/ipatests/azure/scripts/azure-run-tests.sh @@ -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}" \