aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2020-11-06 14:14:26 +0100
committerGravatar GitHub <noreply@github.com> 2020-11-06 14:14:26 +0100
commitcd5ee7d1f08d18d922da08191a9987e3ee622411 (patch)
tree7ed98a3a375036881a84d82151ec819551ed27ac /test
parent049369583bec9c6f3ab751cd68bcfc4224e7df45 (diff)
downloadcoredns-cd5ee7d1f08d18d922da08191a9987e3ee622411.tar.gz
coredns-cd5ee7d1f08d18d922da08191a9987e3ee622411.tar.zst
coredns-cd5ee7d1f08d18d922da08191a9987e3ee622411.zip
Remove travis and move to github workflow (#4267)
Add github testing workflow, simplify the Makefile because that was complex because of Travis. Remove the fuzzing, needs to be re-added when that works properly with go modules (it has been disabled for quite some time). Multiple builds and files have been added so these tests can all run in parallel. Our testing now tests a couple of minutes, the codeql is by far the more expensive. Move metric's naming test to test/presubmit_test.go Add longer sleep in the TestAutoAXFR. Bye bye travis! Closes: #4266 Signed-off-by: Miek Gieben <miek@miek.nl>
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)
+ }
+}