mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-01-14 07:20:37 -08:00
Fix two staticcheck issues in IPVS collector tests
This commit is contained in:
parent
0a7f124fe8
commit
c8e546926a
|
@ -15,6 +15,7 @@ package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -23,6 +24,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"github.com/prometheus/procfs"
|
"github.com/prometheus/procfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ func TestIPVSCollector(t *testing.T) {
|
||||||
go func() {
|
go func() {
|
||||||
err = collector.Update(sink)
|
err = collector.Update(sink)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
panic(fmt.Sprintf("failed to update collector: %v", err))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
for expected, got := range map[string]string{
|
for expected, got := range map[string]string{
|
||||||
|
@ -178,7 +180,7 @@ func TestIPVSCollectorResponse(t *testing.T) {
|
||||||
prometheus.MustRegister(miniCollector{c: collector})
|
prometheus.MustRegister(miniCollector{c: collector})
|
||||||
|
|
||||||
rw := httptest.NewRecorder()
|
rw := httptest.NewRecorder()
|
||||||
prometheus.Handler().ServeHTTP(rw, &http.Request{})
|
promhttp.Handler().ServeHTTP(rw, &http.Request{})
|
||||||
|
|
||||||
metricsFile := "fixtures/ip_vs_result.txt"
|
metricsFile := "fixtures/ip_vs_result.txt"
|
||||||
wantMetrics, err := ioutil.ReadFile(metricsFile)
|
wantMetrics, err := ioutil.ReadFile(metricsFile)
|
||||||
|
|
Loading…
Reference in a new issue