Remove prometheus references in test/integration

This PR does minimal changes to interface to allow removing all
references to prometheus from `test` directory. In future I would expect
wrapping prometheus samples to provide better abstraction. Changes:

Move generic_metrics.go to testutil/metrics.go
Remove etcd.go as it was not called
Move prometheus label consts to testutil.
This commit is contained in:
Marek Siarkowicz
2019-10-24 12:10:12 +02:00
parent 7d13dfe3c3
commit 09329b5bbc
18 changed files with 231 additions and 435 deletions

View File

@@ -16,22 +16,24 @@ limitations under the License.
package metrics
import "k8s.io/component-base/metrics/testutil"
// APIServerMetrics is metrics for API server
type APIServerMetrics Metrics
type APIServerMetrics testutil.Metrics
// Equal returns true if all metrics are the same as the arguments.
func (m *APIServerMetrics) Equal(o APIServerMetrics) bool {
return (*Metrics)(m).Equal(Metrics(o))
return (*testutil.Metrics)(m).Equal(testutil.Metrics(o))
}
func newAPIServerMetrics() APIServerMetrics {
result := NewMetrics()
result := testutil.NewMetrics()
return APIServerMetrics(result)
}
func parseAPIServerMetrics(data string) (APIServerMetrics, error) {
result := newAPIServerMetrics()
if err := parseMetrics(data, (*Metrics)(&result)); err != nil {
if err := testutil.ParseMetrics(data, (*testutil.Metrics)(&result)); err != nil {
return APIServerMetrics{}, err
}
return result, nil