mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 21:25:09 +00:00
Merge pull request #73978 from oomichi/golint-e2e-framework-timer
Fix golint failures of test/e2e/framework/timer
This commit is contained in:
@@ -687,7 +687,6 @@ test/e2e/framework/providers/aws
|
|||||||
test/e2e/framework/providers/azure
|
test/e2e/framework/providers/azure
|
||||||
test/e2e/framework/providers/gce
|
test/e2e/framework/providers/gce
|
||||||
test/e2e/framework/providers/kubemark
|
test/e2e/framework/providers/kubemark
|
||||||
test/e2e/framework/timer
|
|
||||||
test/e2e/instrumentation
|
test/e2e/instrumentation
|
||||||
test/e2e/instrumentation/logging
|
test/e2e/instrumentation/logging
|
||||||
test/e2e/instrumentation/monitoring
|
test/e2e/instrumentation/monitoring
|
||||||
|
@@ -29,7 +29,7 @@ import (
|
|||||||
|
|
||||||
var now = time.Now
|
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 {
|
type Phase struct {
|
||||||
sequenceNumber int
|
sequenceNumber int
|
||||||
name string
|
name string
|
||||||
@@ -63,9 +63,8 @@ func (phase *Phase) duration() time.Duration {
|
|||||||
func (phase *Phase) humanReadable() string {
|
func (phase *Phase) humanReadable() string {
|
||||||
if phase.ended() {
|
if phase.ended() {
|
||||||
return fmt.Sprintf("Phase %s: %v\n", phase.label(), phase.duration())
|
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.
|
// A TestPhaseTimer groups phases and provides a way to export their measurements as JSON or human-readable text.
|
||||||
@@ -93,10 +92,12 @@ func (timer *TestPhaseTimer) StartPhase(sequenceNumber int, phaseName string) *P
|
|||||||
return newPhase
|
return newPhase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SummaryKind returns the summary of test summary.
|
||||||
func (timer *TestPhaseTimer) SummaryKind() string {
|
func (timer *TestPhaseTimer) SummaryKind() string {
|
||||||
return "TestPhaseTimer"
|
return "TestPhaseTimer"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrintHumanReadable returns durations of all phases.
|
||||||
func (timer *TestPhaseTimer) PrintHumanReadable() string {
|
func (timer *TestPhaseTimer) PrintHumanReadable() string {
|
||||||
buf := bytes.Buffer{}
|
buf := bytes.Buffer{}
|
||||||
timer.lock.Lock()
|
timer.lock.Lock()
|
||||||
@@ -107,6 +108,7 @@ func (timer *TestPhaseTimer) PrintHumanReadable() string {
|
|||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrintJSON returns durations of all phases with JSON format.
|
||||||
func (timer *TestPhaseTimer) PrintJSON() string {
|
func (timer *TestPhaseTimer) PrintJSON() string {
|
||||||
data := perftype.PerfData{
|
data := perftype.PerfData{
|
||||||
Version: "v1",
|
Version: "v1",
|
||||||
|
Reference in New Issue
Block a user