ci: Increase unit test coverage (#466)

Add unit test for Tool invoke handler.
Exclude config.go from coverage calculation.

---------

Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>
This commit is contained in:
Wenxin Du
2025-04-22 21:57:46 -04:00
committed by GitHub
parent ba0d6489eb
commit 073ca58ac1
3 changed files with 78 additions and 1 deletions

View File

@@ -86,6 +86,9 @@ jobs:
- name: Check coverage
run: |
FILE_TO_EXCLUDE="github.com/googleapis/genai-toolbox/internal/server/"
ESCAPED_PATH=$(echo "$FILE_TO_EXCLUDE" | sed 's/\//\\\//g; s/\./\\\./g')
sed -i "/^${ESCAPED_PATH}:/d" coverage.out
total_coverage=$(go tool cover -func=coverage.out | grep "total:" | awk '{print $3}')
echo "Total coverage: $total_coverage"
coverage_numeric=$(echo "$total_coverage" | sed 's/%//')