Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix golint failures of test/e2e/framework/timer #73978

Merged
merged 1 commit into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ test/e2e/framework/providers/aws
test/e2e/framework/providers/azure
test/e2e/framework/providers/gce
test/e2e/framework/providers/kubemark
test/e2e/framework/timer
test/e2e/instrumentation
test/e2e/instrumentation/logging
test/e2e/instrumentation/monitoring
Expand Down
8 changes: 5 additions & 3 deletions test/e2e/framework/timer/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

var now = time.Now

// Represents a phase of a test. Phases can overlap.
// Phase represents a phase of a test. Phases can overlap.
type Phase struct {
sequenceNumber int
name string
Expand Down Expand Up @@ -63,9 +63,8 @@ func (phase *Phase) duration() time.Duration {
func (phase *Phase) humanReadable() string {
if phase.ended() {
return fmt.Sprintf("Phase %s: %v\n", phase.label(), phase.duration())
} else {
return fmt.Sprintf("Phase %s: %v so far\n", phase.label(), phase.duration())
}
return fmt.Sprintf("Phase %s: %v so far\n", phase.label(), phase.duration())
}

// A TestPhaseTimer groups phases and provides a way to export their measurements as JSON or human-readable text.
Expand Down Expand Up @@ -93,10 +92,12 @@ func (timer *TestPhaseTimer) StartPhase(sequenceNumber int, phaseName string) *P
return newPhase
}

// SummaryKind returns the summary of test summary.
func (timer *TestPhaseTimer) SummaryKind() string {
return "TestPhaseTimer"
}

// PrintHumanReadable returns durations of all phases.
func (timer *TestPhaseTimer) PrintHumanReadable() string {
buf := bytes.Buffer{}
timer.lock.Lock()
Expand All @@ -107,6 +108,7 @@ func (timer *TestPhaseTimer) PrintHumanReadable() string {
return buf.String()
}

// PrintJSON returns durations of all phases with JSON format.
func (timer *TestPhaseTimer) PrintJSON() string {
data := perftype.PerfData{
Version: "v1",
Expand Down