Skip to content

Instantly share code, notes, and snippets.

@WilliamDenniss
Last active June 23, 2017 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WilliamDenniss/de8fa10dd8d8ba9b10a6598ec7218c55 to your computer and use it in GitHub Desktop.
Save WilliamDenniss/de8fa10dd8d8ba9b10a6598ec7218c55 to your computer and use it in GitHub Desktop.
Counts the number of helm tests in subfolders
#!/bin/bash
# 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
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment