Address review comments.

This commit is contained in:
Katharine Berry
2018-08-31 10:49:36 -07:00
parent 9d499cd005
commit 0fb4b920b5
2 changed files with 4 additions and 6 deletions

View File

@@ -49,8 +49,8 @@ func InitCoverage(name string) {
coverageFile = "/tmp/k8s-" + name + ".cov"
}
// Set up the unit test framework with the arguments we want.
flag.CommandLine.Parse([]string{"-test.coverprofile=" + tempCoveragePath()})
// Set up the unit test framework with the required arguments to activate test coverage.
flag.CommandLine.Parse([]string{"-test.coverprofile", tempCoveragePath()})
// Begin periodic logging
go wait.Forever(FlushCoverage, flushInterval)
@@ -76,8 +76,6 @@ func FlushCoverage() {
// This gets us atomic updates from the perspective of another process trying to access
// the file.
if err := os.Rename(tempCoveragePath(), coverageFile); err != nil {
// This should never fail, because we're in the same directory. There's also little that
// we can do if it does.
glog.Errorf("Couldn't move coverage file from %s to %s", coverageFile, tempCoveragePath())
}
}