Skip to content

Instantly share code, notes, and snippets.

Last active June 23, 2017 22:58
What would you like to do?
Counts the number of helm tests in subfolders
# Iterates all subdirectors of the current path.
for d in */ ; do
# Count instances of test annotations in folder.
COUNT=`egrep -r "test-success|test-failure" "$d" | wc -l`
# Colors!
COUNT_COLOR=$([ $COUNT -gt 0 ] && echo "$(tput setaf 2)" || echo "$(tput setaf 1)")
BLACK=$(tput setaf 0)
# Strip slash from directory name
CHART=`echo "$d" | sed -E "s/(.*)\//\1/"`
# Output
printf "%-30s %s%s test(s)%s\n" $CHART $COUNT_COLOR $COUNT $BLACK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment