chore: add more tests (#2815)
* chore: add more tests * chore: add more tests * chore: add more tests * chore: add more tests * chore: add more tests * chore: add more tests
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/zeromicro/go-zero/core/proc"
|
||||
"github.com/zeromicro/go-zero/core/prometheus"
|
||||
)
|
||||
|
||||
@@ -17,6 +18,9 @@ func TestNewCounterVec(t *testing.T) {
|
||||
})
|
||||
defer counterVec.close()
|
||||
counterVecNil := NewCounterVec(nil)
|
||||
counterVec.Inc("path", "code")
|
||||
counterVec.Add(1, "path", "code")
|
||||
proc.Shutdown()
|
||||
assert.NotNil(t, counterVec)
|
||||
assert.Nil(t, counterVecNil)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/zeromicro/go-zero/core/proc"
|
||||
)
|
||||
|
||||
func TestNewGaugeVec(t *testing.T) {
|
||||
@@ -18,6 +19,8 @@ func TestNewGaugeVec(t *testing.T) {
|
||||
gaugeVecNil := NewGaugeVec(nil)
|
||||
assert.NotNil(t, gaugeVec)
|
||||
assert.Nil(t, gaugeVecNil)
|
||||
|
||||
proc.Shutdown()
|
||||
}
|
||||
|
||||
func TestGaugeInc(t *testing.T) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/zeromicro/go-zero/core/proc"
|
||||
)
|
||||
|
||||
func TestNewHistogramVec(t *testing.T) {
|
||||
@@ -47,4 +48,6 @@ func TestHistogramObserve(t *testing.T) {
|
||||
|
||||
err := testutil.CollectAndCompare(hv.histogram, strings.NewReader(metadata+val))
|
||||
assert.Nil(t, err)
|
||||
|
||||
proc.Shutdown()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user