diff --git a/pkg/util/coverage/coverage.go b/pkg/util/coverage/coverage.go index bf95ae4379..020c30657a 100644 --- a/pkg/util/coverage/coverage.go +++ b/pkg/util/coverage/coverage.go @@ -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()})