mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
af315539d4
See also #30832 This PR removes time tick delay metrics when rootcoord GetMetrics response does not have previously existed querynode/datanode Also add unit tests for this case --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com> Signed-off-by: Congqi.Xia <congqi.xia@zilliz.com>
23 lines
726 B
Go
23 lines
726 B
Go
package testutils
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/testutil"
|
|
"github.com/stretchr/testify/suite"
|
|
)
|
|
|
|
// PromMetricsSuite is a util suite wrapper providing prometheus metrics assertion functions.
|
|
type PromMetricsSuite struct {
|
|
suite.Suite
|
|
}
|
|
|
|
func (suite *PromMetricsSuite) MetricsEqual(c prometheus.Collector, expect float64, msgAndArgs ...any) bool {
|
|
value := testutil.ToFloat64(c)
|
|
return suite.Suite.Equal(expect, value, msgAndArgs...)
|
|
}
|
|
|
|
func (suite *PromMetricsSuite) CollectCntEqual(c prometheus.Collector, expect int, msgAndArgs ...any) bool {
|
|
cnt := testutil.CollectAndCount(c)
|
|
return suite.Suite.EqualValues(expect, cnt, msgAndArgs...)
|
|
}
|