From 00816363e4f17f505f1808fc64afcdf1b6721e51 Mon Sep 17 00:00:00 2001 From: Bjoern Rabenstein Date: Fri, 25 Apr 2014 12:32:35 +0200 Subject: [PATCH] Remove the one duplication of the Tester interface. Change-Id: Ie17ec3393a7e12e0f27e51b4060aa478a172f612 --- prometheus/counter_test.go | 4 +++- prometheus/gauge_test.go | 4 +++- prometheus/interface.go | 14 -------------- prometheus/registry_test.go | 9 +++++---- prometheus/untyped_test.go | 4 +++- test/test.go | 1 + 6 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 prometheus/interface.go diff --git a/prometheus/counter_test.go b/prometheus/counter_test.go index 8f0dffd..b430e5e 100644 --- a/prometheus/counter_test.go +++ b/prometheus/counter_test.go @@ -9,9 +9,11 @@ package prometheus import ( "encoding/json" "testing" + + "github.com/prometheus/client_golang/test" ) -func testCounter(t tester) { +func testCounter(t test.Tester) { type input struct { steps []func(g Counter) } diff --git a/prometheus/gauge_test.go b/prometheus/gauge_test.go index 1380ad7..9346694 100644 --- a/prometheus/gauge_test.go +++ b/prometheus/gauge_test.go @@ -9,9 +9,11 @@ package prometheus import ( "encoding/json" "testing" + + "github.com/prometheus/client_golang/test" ) -func testGauge(t tester) { +func testGauge(t test.Tester) { type input struct { steps []func(g Gauge) } diff --git a/prometheus/interface.go b/prometheus/interface.go deleted file mode 100644 index 9b5de19..0000000 --- a/prometheus/interface.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2013, Prometheus Team -// All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package prometheus - -type tester interface { - Error(args ...interface{}) - Errorf(format string, args ...interface{}) - Fatal(args ...interface{}) - Fatalf(format string, args ...interface{}) -} diff --git a/prometheus/registry_test.go b/prometheus/registry_test.go index b153822..85cab7c 100644 --- a/prometheus/registry_test.go +++ b/prometheus/registry_test.go @@ -20,9 +20,10 @@ import ( "code.google.com/p/goprotobuf/proto" "github.com/prometheus/client_golang/model" + "github.com/prometheus/client_golang/test" ) -func testRegister(t tester) { +func testRegister(t test.Tester) { var oldState = struct { abortOnMisuse bool debugRegistration bool @@ -205,7 +206,7 @@ func (r *fakeResponseWriter) Write(d []byte) (l int, err error) { func (r *fakeResponseWriter) WriteHeader(c int) { } -func testHandler(t tester) { +func testHandler(t test.Tester) { metric := NewCounter() metric.Increment(map[string]string{"labelname": "val1"}) @@ -484,7 +485,7 @@ func BenchmarkHandler(b *testing.B) { } } -func testDecorateWriter(t tester) { +func testDecorateWriter(t test.Tester) { type input struct { headers map[string]string body []byte @@ -569,7 +570,7 @@ func BenchmarkDecorateWriter(b *testing.B) { } } -func testDumpToWriter(t tester) { +func testDumpToWriter(t test.Tester) { type input struct { metrics map[string]Metric } diff --git a/prometheus/untyped_test.go b/prometheus/untyped_test.go index f39cd87..b2a2b57 100644 --- a/prometheus/untyped_test.go +++ b/prometheus/untyped_test.go @@ -9,9 +9,11 @@ package prometheus import ( "encoding/json" "testing" + + "github.com/prometheus/client_golang/test" ) -func testUntyped(t tester) { +func testUntyped(t test.Tester) { type input struct { steps []func(g Untyped) } diff --git a/test/test.go b/test/test.go index 225aa70..a4440aa 100644 --- a/test/test.go +++ b/test/test.go @@ -14,6 +14,7 @@ // Package test provides common test helpers to the client library. package test +// Tester is an interface implemented by both, testing.T and testing.B. type Tester interface { Error(args ...interface{}) Errorf(format string, args ...interface{})