diff --git a/hack/.golint_failures b/hack/.golint_failures index d604fc5584a..5a26ee57026 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -556,7 +556,6 @@ staging/src/k8s.io/sample-apiserver/pkg/apis/wardle/v1alpha1 staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/fischer staging/src/k8s.io/sample-apiserver/pkg/registry/wardle/flunder test/e2e/common -test/e2e/framework/metrics test/e2e/lifecycle/bootstrap test/e2e/storage/vsphere test/e2e_kubeadm diff --git a/test/e2e/apimachinery/garbage_collector.go b/test/e2e/apimachinery/garbage_collector.go index cfa56799cd6..04d39c17afb 100644 --- a/test/e2e/apimachinery/garbage_collector.go +++ b/test/e2e/apimachinery/garbage_collector.go @@ -250,7 +250,7 @@ func gatherMetrics(f *framework.Framework) { if err != nil { e2elog.Logf("MetricsGrabber failed grab metrics. Skipping metrics gathering.") } else { - summary = (*e2emetrics.MetricsForE2E)(&received) + summary = (*e2emetrics.ComponentCollection)(&received) e2elog.Logf(summary.PrintHumanReadable()) } } diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index d1b2b14a6b0..13fabcefe44 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -372,8 +372,8 @@ func (f *Framework) AfterEach() { if err != nil { e2elog.Logf("MetricsGrabber failed to grab some of the metrics: %v", err) } - (*e2emetrics.MetricsForE2E)(&received).ComputeClusterAutoscalerMetricsDelta(f.clusterAutoscalerMetricsBeforeTest) - f.TestSummaries = append(f.TestSummaries, (*e2emetrics.MetricsForE2E)(&received)) + (*e2emetrics.ComponentCollection)(&received).ComputeClusterAutoscalerMetricsDelta(f.clusterAutoscalerMetricsBeforeTest) + f.TestSummaries = append(f.TestSummaries, (*e2emetrics.ComponentCollection)(&received)) } } diff --git a/test/e2e/framework/metrics/e2e_metrics.go b/test/e2e/framework/metrics/e2e_metrics.go index 93ad96be9e6..7dad19648ab 100644 --- a/test/e2e/framework/metrics/e2e_metrics.go +++ b/test/e2e/framework/metrics/e2e_metrics.go @@ -33,10 +33,10 @@ const ( caFunctionMetricLabel = "function" ) -// MetricsForE2E is metrics collection of components. -type MetricsForE2E Collection +// ComponentCollection is metrics collection of components. +type ComponentCollection Collection -func (m *MetricsForE2E) filterMetrics() { +func (m *ComponentCollection) filterMetrics() { apiServerMetrics := make(APIServerMetrics) for _, metric := range interestingAPIServerMetrics { apiServerMetrics[metric] = (*m).APIServerMetrics[metric] @@ -78,7 +78,7 @@ func printSample(sample *model.Sample) string { } // PrintHumanReadable returns e2e metrics with JSON format. -func (m *MetricsForE2E) PrintHumanReadable() string { +func (m *ComponentCollection) PrintHumanReadable() string { buf := bytes.Buffer{} for _, interestingMetric := range interestingAPIServerMetrics { buf.WriteString(fmt.Sprintf("For %v:\n", interestingMetric)) @@ -126,14 +126,14 @@ func PrettyPrintJSON(metrics interface{}) string { } // PrintJSON returns e2e metrics with JSON format. -func (m *MetricsForE2E) PrintJSON() string { +func (m *ComponentCollection) PrintJSON() string { m.filterMetrics() return PrettyPrintJSON(m) } // SummaryKind returns the summary of e2e metrics. -func (m *MetricsForE2E) SummaryKind() string { - return "MetricsForE2E" +func (m *ComponentCollection) SummaryKind() string { + return "ComponentCollection" } func makeKey(a, b model.LabelValue) string { @@ -142,7 +142,7 @@ func makeKey(a, b model.LabelValue) string { // ComputeClusterAutoscalerMetricsDelta computes the change in cluster // autoscaler metrics. -func (m *MetricsForE2E) ComputeClusterAutoscalerMetricsDelta(before Collection) { +func (m *ComponentCollection) ComputeClusterAutoscalerMetricsDelta(before Collection) { if beforeSamples, found := before.ClusterAutoscalerMetrics[caFunctionMetric]; found { if afterSamples, found := m.ClusterAutoscalerMetrics[caFunctionMetric]; found { beforeSamplesMap := make(map[string]*model.Sample) diff --git a/test/e2e/framework/suites.go b/test/e2e/framework/suites.go index 7578034f717..97ef26fc2d7 100644 --- a/test/e2e/framework/suites.go +++ b/test/e2e/framework/suites.go @@ -180,7 +180,7 @@ func gatherTestSuiteMetrics() error { return fmt.Errorf("failed to grab metrics: %v", err) } - metricsForE2E := (*e2emetrics.MetricsForE2E)(&received) + metricsForE2E := (*e2emetrics.ComponentCollection)(&received) metricsJSON := metricsForE2E.PrintJSON() if TestContext.ReportDir != "" { filePath := path.Join(TestContext.ReportDir, "MetricsForE2ESuite_"+time.Now().Format(time.RFC3339)+".json")