This repository was archived by the owner on Jul 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 11* .tar.gz
22* .dockerapp
33_build /
4+ codecoverage /* .out
45! examples /simple /* .dockerapp
Original file line number Diff line number Diff line change @@ -84,6 +84,15 @@ unit-test:
8484clean :
8585 rm -Rf ./_build docker-app-* .tar.gz
8686
87+ coverage-bin :
88+ $(GO_TEST ) -coverpkg=" ./..." -c -tags testrunmain -o _build/$(BIN_NAME ) .cov
89+
90+ coverage : coverage-bin
91+ DOCKERAPP_BINARY=../codecoverage/coverage-bin $(GO_TEST ) -v ./e2e
92+ $(GO_TEST ) -cover -test.coverprofile=codecoverage/unit.out $(shell go list ./... | grep -vE '/vendor/|/e2e')
93+ gocovmerge codecoverage/* .out > codecoverage/all.out
94+ go tool cover -func codecoverage/all.out
95+
8796# #########################
8897# Continuous Integration #
8998# #########################
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # This script is a proxy that injects the required test flags and strips out test output
4+ # It allows us to use a coverage-enabled binary for e2e tests
5+
6+ ../_build/docker-app.cov $* -test.v -test.coverprofile=../codecoverage/e2e.out | \
7+ grep -vE ' ^PASS$' | grep -vE ' ^coverage: [0-9]+\.[0-9]+% of statements in .+$' | grep -v ' ^=== RUN TestRunMain$'
Original file line number Diff line number Diff line change 1+ // +build testrunmain
2+
3+ package main
4+
5+ import "testing"
6+
7+ func TestRunMain (t * testing.T ) {
8+ main ()
9+ }
You can’t perform that action at this time.
0 commit comments