aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/auto_test.go2
-rw-r--r--test/presubmit_test.go19
2 files changed, 20 insertions, 1 deletions
diff --git a/test/auto_test.go b/test/auto_test.go
index f7502172f..906f5223e 100644
--- a/test/auto_test.go
+++ b/test/auto_test.go
@@ -142,7 +142,7 @@ func TestAutoAXFR(t *testing.T) {
t.Fatal(err)
}
- time.Sleep(10 * time.Millisecond) // wait for it to be picked up
+ time.Sleep(50 * time.Millisecond) // wait for it to be picked up
tr := new(dns.Transfer)
m := new(dns.Msg)
diff --git a/test/presubmit_test.go b/test/presubmit_test.go
index 44692b160..f2b4c8bea 100644
--- a/test/presubmit_test.go
+++ b/test/presubmit_test.go
@@ -9,6 +9,7 @@ import (
"go/parser"
"go/token"
"os"
+ "os/exec"
"path/filepath"
"strings"
"testing"
@@ -400,3 +401,21 @@ func importtype(s string) string {
}
return "std"
}
+
+// TestMetricNaming tests the imports path used for metrics. It depends on faillint to be installed: go install github.com/fatih/faillint
+func TestPrometheusImports(t *testing.T) {
+ if _, err := exec.LookPath("faillint"); err != nil {
+ fmt.Fprintf(os.Stderr, "Not executing TestPrometheusImports: faillint not found\n")
+ return
+ }
+
+ // make this multiline?
+ p := `github.com/prometheus/client_golang/prometheus.{NewCounter,NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,NewHistorgram,NewHistogramVec,NewSummary,NewSummaryVec}=github.com/prometheus/client_golang/prometheus/promauto.{NewCounter,NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,NewHistorgram,NewHistogramVec,NewSummary,NewSummaryVec}`
+
+ cmd := exec.Command("faillint", "-paths", p, "./...")
+ cmd.Dir = ".."
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("Failed: %s\n%s", err, out)
+ }
+}