github.com/jenkins-x/jx/v2@v2.1.155/hack/ensure-test-classification.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # get the dir of this scipt
     4  dir=$(dirname "$0")
     5  
     6  declare -a unclassified
     7  
     8  while IFS= read -r -d '' file
     9  do
    10    [ -z "$(sed -n '/^\/\/ +build/p;q' "$file")" ] && unclassified+=("$file")
    11  done < <(find ${dir}/.. -name '*_test.go' -print0)
    12  
    13  if [ "${#unclassified[@]}" -eq "0" ]; then
    14    echo "OK - all test files contain a build tag"
    15    exit 0
    16  fi
    17  
    18  echo "The following ${#unclassified[@]} test files are not classified with a valid Go build tag [unit|integration]"
    19  for i in "${unclassified[@]}"
    20  do
    21    echo "$i"
    22  done
    23  exit 1