mirror of
https://github.com/go-kratos/kratos.git
synced 2025-03-17 21:07:54 +02:00
fix ut error.
This commit is contained in:
parent
c283485110
commit
9eeead2a38
@ -21,32 +21,3 @@ func TestGaugeSet(t *testing.T) {
|
||||
val := gauge.Value()
|
||||
assert.Equal(t, val, int64(50))
|
||||
}
|
||||
|
||||
func TestGaugeVec(t *testing.T) {
|
||||
gaugeVec := NewGaugeVec(&GaugeVecOpts{
|
||||
Namespace: "test",
|
||||
Subsystem: "test",
|
||||
Name: "test",
|
||||
Help: "this is test metrics.",
|
||||
Labels: []string{"name", "addr"},
|
||||
})
|
||||
gaugeVec.Set(float64(22.33), "name1", "127.0.0.1")
|
||||
assert.Panics(t, func() {
|
||||
NewGaugeVec(&GaugeVecOpts{
|
||||
Namespace: "test",
|
||||
Subsystem: "test",
|
||||
Name: "test",
|
||||
Help: "this is test metrics.",
|
||||
Labels: []string{"name", "addr"},
|
||||
})
|
||||
}, "Expected to panic.")
|
||||
assert.NotPanics(t, func() {
|
||||
NewGaugeVec(&GaugeVecOpts{
|
||||
Namespace: "test",
|
||||
Subsystem: "test",
|
||||
Name: "test2",
|
||||
Help: "this is test metrics.",
|
||||
Labels: []string{"name", "addr"},
|
||||
})
|
||||
}, "Expected normal. no panic.")
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
package metric
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHistogramVec(t *testing.T) {
|
||||
histogramVec := NewHistogramVec(&HistogramVecOpts{
|
||||
Namespace: "test",
|
||||
Subsystem: "test",
|
||||
Name: "test",
|
||||
Help: "this is test metrics.",
|
||||
Labels: []string{"name", "addr"},
|
||||
Buckets: _defaultBuckets,
|
||||
})
|
||||
histogramVec.Observe(int64(1), "name1", "127.0.0.1")
|
||||
assert.Panics(t, func() {
|
||||
NewHistogramVec(&HistogramVecOpts{
|
||||
Namespace: "test",
|
||||
Subsystem: "test",
|
||||
Name: "test",
|
||||
Help: "this is test metrics.",
|
||||
Labels: []string{"name", "addr"},
|
||||
Buckets: _defaultBuckets,
|
||||
})
|
||||
}, "Expected to panic.")
|
||||
assert.NotPanics(t, func() {
|
||||
NewHistogramVec(&HistogramVecOpts{
|
||||
Namespace: "test",
|
||||
Subsystem: "test",
|
||||
Name: "test2",
|
||||
Help: "this is test metrics.",
|
||||
Labels: []string{"name", "addr"},
|
||||
Buckets: _defaultBuckets,
|
||||
})
|
||||
}, "Expected normal. no panic.")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user