Skip to content

Commit b5fabfd

Browse files
committed
Fix coverage to measure keyword_classifier.go specifically
- Add -coverpkg flag to measure classification package coverage - Filter coverage report to show only keyword_classifier.go functions - Calculate average coverage across keyword_classifier.go (NewKeywordClassifier, Classify, matches) - Current coverage: 87.1% (exceeds 80% threshold) - Full package coverage is 4.9%, but keyword_classifier.go coverage is 87.1% Signed-off-by: Senan Zedan <[email protected]>
1 parent ff6a001 commit b5fabfd

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

.github/workflows/unit-test-e2e-testcases.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,25 @@ jobs:
7373
run: |
7474
cd e2e-tests/testcases
7575
echo "Running keyword routing tests..."
76-
go test -v -run "Keyword Routing" -coverprofile=coverage-keyword.out -covermode=atomic
76+
go test -v -run "Keyword Routing" -coverprofile=coverage-keyword.out -covermode=atomic -coverpkg=github.com/vllm-project/semantic-router/src/semantic-router/pkg/classification
7777
7878
- name: Generate coverage report
7979
if: always()
8080
run: |
8181
cd e2e-tests/testcases
8282
go tool cover -func=coverage-keyword.out > coverage-summary.txt
83-
echo "=== Coverage Summary ==="
83+
echo "=== Full Coverage Summary ==="
8484
cat coverage-summary.txt
8585
86-
# Extract total coverage
87-
TOTAL_COVERAGE=$(grep "total:" coverage-summary.txt | awk '{print $3}')
88-
echo "Total coverage: $TOTAL_COVERAGE"
89-
echo "COVERAGE=$TOTAL_COVERAGE" >> $GITHUB_ENV
86+
echo ""
87+
echo "=== Keyword Classifier Coverage ==="
88+
grep "keyword_classifier.go" coverage-summary.txt || echo "No keyword_classifier.go coverage found"
89+
90+
# Extract coverage for keyword_classifier.go only
91+
# Filter lines containing keyword_classifier.go, extract percentage, calculate average
92+
KEYWORD_COVERAGE=$(grep "keyword_classifier.go" coverage-summary.txt | awk '{gsub(/%/, "", $NF); sum+=$NF; count++} END {if(count>0) printf "%.1f", sum/count; else print "0.0"}')
93+
echo "Keyword Classifier Average Coverage: ${KEYWORD_COVERAGE}%"
94+
echo "COVERAGE=${KEYWORD_COVERAGE}%" >> $GITHUB_ENV
9095
9196
- name: Check coverage threshold
9297
if: always()

0 commit comments

Comments
 (0)