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>
This commit is contained in:
Miek Gieben
2020-11-06 14:14:26 +01:00
committed by GitHub
parent 049369583b
commit cd5ee7d1f0
9 changed files with 117 additions and 130 deletions

View File

@@ -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)
}
}