Webhook-to-SSE gateway with hierarchical topic routing and signature verification
at main 18 lines 552 B view raw
1#!/bin/bash 2set -euo pipefail 3 4THRESHOLD="${1:-100}" 5PROFILE=$(mktemp) 6trap 'rm -f "$PROFILE"' EXIT 7 8go test -coverprofile="$PROFILE" -covermode=atomic ./... 9 10# Exclude main.go from coverage calculation (entrypoint, not unit-testable) 11COVERAGE=$(grep -v "main\.go:" "$PROFILE" | go tool cover -func=/dev/stdin | grep ^total: | awk '{print $3}' | tr -d '%') 12 13if awk "BEGIN{exit(!($COVERAGE < $THRESHOLD))}"; then 14 echo "FAIL: coverage ${COVERAGE}% is below ${THRESHOLD}%" 15 exit 1 16fi 17 18echo "OK: coverage ${COVERAGE}% meets ${THRESHOLD}% threshold"