mirror of https://github.com/prometheus/prometheus
use testutil assertions in the cmd/prometheus package
parent
8c1b9e45cf
commit
d7b4fa8d78
|
@ -13,7 +13,11 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/prometheus/prometheus/util/testutil"
|
||||||
|
)
|
||||||
|
|
||||||
func TestComputeExternalURL(t *testing.T) {
|
func TestComputeExternalURL(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -54,13 +58,12 @@ func TestComputeExternalURL(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for _, test := range tests {
|
||||||
r, err := computeExternalURL(test.input, "0.0.0.0:9090")
|
_, err := computeExternalURL(test.input, "0.0.0.0:9090")
|
||||||
if test.valid && err != nil {
|
if test.valid {
|
||||||
t.Errorf("%d. expected input to be valid, got %s", i, err)
|
testutil.Ok(t, err)
|
||||||
} else if !test.valid && err == nil {
|
} else {
|
||||||
t.Logf("%+v", test, r)
|
testutil.NotOk(t, err)
|
||||||
t.Errorf("%d. expected input to be invalid", i)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue