Skip to content

Commit 96d1fcb

Browse files
author
alxndrsn
committed
check-docker-context: print report before running checks
This allows for full reporting before failure in the case of check(s) failing.
1 parent f279b4e commit 96d1fcb

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

test/check-docker-context.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ throw_err() {
9797
exit 1
9898
}
9999

100-
log "File count: $file_count"
101-
if [[ "${skip_count-}" != "true" ]]; then
102-
if [[ "$file_count" -lt "$min_count" ]] || [[ "$file_count" -gt "$max_count" ]]; then
103-
throw_err "This is a surprising number of files - expected between $min_count and $max_count"
104-
fi
105-
fi
106-
107100
human_size() {
108101
if [[ "$1" -gt 999999 ]]; then
109102
echo "$(bc <<< "scale=3; $1 / 1000000") GB"
@@ -112,7 +105,15 @@ human_size() {
112105
fi
113106
}
114107

108+
log "File count: $file_count"
115109
log "Total size: $(human_size "$total_size")"
110+
111+
if [[ "${skip_count-}" != "true" ]]; then
112+
if [[ "$file_count" -lt "$min_count" ]] || [[ "$file_count" -gt "$max_count" ]]; then
113+
throw_err "This is a surprising number of files - expected between $min_count and $max_count"
114+
fi
115+
fi
116+
116117
if [[ "${skip_size-}" != "true" ]]; then
117118
# N.B. busybox `du` outputs in kB
118119
# See: https://www.busybox.net/downloads/BusyBox.html#du

0 commit comments

Comments
 (0)