Add KUBE_COVERAGE_FLUSH_INTERVAL to set flush interval.

pull/8/head
Katharine Berry 2018-08-31 15:52:48 -07:00
parent 0fb4b920b5
commit 2d36e9e874
1 changed files with 5 additions and 1 deletions

View File

@ -29,7 +29,7 @@ import (
"time"
)
const flushInterval = 5 * time.Second
var flushInterval = 5 * time.Second
var coverageFile string
@ -49,6 +49,10 @@ func InitCoverage(name string) {
coverageFile = "/tmp/k8s-" + name + ".cov"
}
if duration, err := time.ParseDuration(os.Getenv("KUBE_COVERAGE_FLUSH_INTERVAL")); err == nil {
flushInterval = duration
}
// Set up the unit test framework with the required arguments to activate test coverage.
flag.CommandLine.Parse([]string{"-test.coverprofile", tempCoveragePath()})