88 . "github.com/onsi/gomega"
99 "github.com/stretchr/testify/assert"
1010
11+ "github.com/flant/shell-operator/internal/metrics"
1112 bindingcontext "github.com/flant/shell-operator/pkg/hook/binding_context"
1213 "github.com/flant/shell-operator/pkg/hook/task_metadata"
1314 "github.com/flant/shell-operator/pkg/hook/types"
@@ -22,14 +23,16 @@ func Test_CombineBindingContext_MultipleHooks(t *testing.T) {
2223
2324 metricStorage := metric .NewStorageMock (t )
2425 metricStorage .HistogramObserveMock .Set (func (metric string , value float64 , labels map [string ]string , buckets []float64 ) {
25- assert .Equal (t , metric , "{PREFIX}tasks_queue_action_duration_seconds" )
26+ assert .Equal (t , metric , metrics . TasksQueueActionDurationSeconds )
2627 assert .NotZero (t , value )
2728 assert .Equal (t , map [string ]string {
2829 "queue_action" : "AddLast" ,
2930 "queue_name" : "test_multiple_hooks" ,
3031 }, labels )
3132 assert .Nil (t , buckets )
3233 })
34+ metricStorage .GaugeSetMock .Set (func (_ string , _ float64 , _ map [string ]string ) {
35+ })
3336
3437 TaskQueues := queue .NewTaskQueueSet ().WithMetricStorage (metricStorage )
3538 TaskQueues .WithContext (context .Background ())
@@ -130,14 +133,16 @@ func Test_CombineBindingContext_Nil_On_NoCombine(t *testing.T) {
130133
131134 metricStorage := metric .NewStorageMock (t )
132135 metricStorage .HistogramObserveMock .Set (func (metric string , value float64 , labels map [string ]string , buckets []float64 ) {
133- assert .Equal (t , metric , "{PREFIX}tasks_queue_action_duration_seconds" )
136+ assert .Equal (t , metric , metrics . TasksQueueActionDurationSeconds )
134137 assert .NotZero (t , value )
135138 assert .Equal (t , map [string ]string {
136139 "queue_action" : "AddLast" ,
137140 "queue_name" : "test_no_combine" ,
138141 }, labels )
139142 assert .Nil (t , buckets )
140143 })
144+ metricStorage .GaugeSetMock .Set (func (_ string , _ float64 , _ map [string ]string ) {
145+ })
141146
142147 TaskQueues := queue .NewTaskQueueSet ().WithMetricStorage (metricStorage )
143148 TaskQueues .WithContext (context .Background ())
@@ -203,14 +208,16 @@ func Test_CombineBindingContext_Group_Compaction(t *testing.T) {
203208
204209 metricStorage := metric .NewStorageMock (t )
205210 metricStorage .HistogramObserveMock .Set (func (metric string , value float64 , labels map [string ]string , buckets []float64 ) {
206- assert .Equal (t , metric , "{PREFIX}tasks_queue_action_duration_seconds" )
211+ assert .Equal (t , metric , metrics . TasksQueueActionDurationSeconds )
207212 assert .NotZero (t , value )
208213 assert .Equal (t , map [string ]string {
209214 "queue_action" : "AddLast" ,
210215 "queue_name" : "test_multiple_hooks" ,
211216 }, labels )
212217 assert .Nil (t , buckets )
213218 })
219+ metricStorage .GaugeSetMock .Set (func (_ string , _ float64 , _ map [string ]string ) {
220+ })
214221
215222 TaskQueues := queue .NewTaskQueueSet ().WithMetricStorage (metricStorage )
216223 TaskQueues .WithContext (context .Background ())
@@ -319,14 +326,16 @@ func Test_CombineBindingContext_Group_Type(t *testing.T) {
319326
320327 metricStorage := metric .NewStorageMock (t )
321328 metricStorage .HistogramObserveMock .Set (func (metric string , value float64 , labels map [string ]string , buckets []float64 ) {
322- assert .Equal (t , metric , "{PREFIX}tasks_queue_action_duration_seconds" )
329+ assert .Equal (t , metric , metrics . TasksQueueActionDurationSeconds )
323330 assert .NotZero (t , value )
324331 assert .Equal (t , map [string ]string {
325332 "queue_action" : "AddLast" ,
326333 "queue_name" : "test_multiple_hooks" ,
327334 }, labels )
328335 assert .Nil (t , buckets )
329336 })
337+ metricStorage .GaugeSetMock .Set (func (_ string , _ float64 , _ map [string ]string ) {
338+ })
330339
331340 TaskQueues := queue .NewTaskQueueSet ().WithMetricStorage (metricStorage )
332341 TaskQueues .WithContext (context .Background ())
0 commit comments