Skip to content

Commit f6a613b

Browse files
committed
chore: fix lint and tests
Signed-off-by: Timur Tuktamyshev <timur.tuktamyshev@flant.com>
1 parent 89131ba commit f6a613b

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

pkg/shell-operator/combine_binding_context_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func Test_CombineBindingContext_MultipleHooks(t *testing.T) {
3131
}, labels)
3232
assert.Nil(t, buckets)
3333
})
34-
metricStorage.GaugeSetMock.Set(func(_ string, _ float64, _ map[string]string) {
34+
metricStorage.GaugeSetMock.Optional().Set(func(_ string, _ float64, _ map[string]string) {
3535
})
3636

3737
TaskQueues := queue.NewTaskQueueSet().WithMetricStorage(metricStorage)
@@ -141,7 +141,7 @@ func Test_CombineBindingContext_Nil_On_NoCombine(t *testing.T) {
141141
}, labels)
142142
assert.Nil(t, buckets)
143143
})
144-
metricStorage.GaugeSetMock.Set(func(_ string, _ float64, _ map[string]string) {
144+
metricStorage.GaugeSetMock.Optional().Set(func(_ string, _ float64, _ map[string]string) {
145145
})
146146

147147
TaskQueues := queue.NewTaskQueueSet().WithMetricStorage(metricStorage)
@@ -216,7 +216,7 @@ func Test_CombineBindingContext_Group_Compaction(t *testing.T) {
216216
}, labels)
217217
assert.Nil(t, buckets)
218218
})
219-
metricStorage.GaugeSetMock.Set(func(_ string, _ float64, _ map[string]string) {
219+
metricStorage.GaugeSetMock.Optional().Set(func(_ string, _ float64, _ map[string]string) {
220220
})
221221

222222
TaskQueues := queue.NewTaskQueueSet().WithMetricStorage(metricStorage)
@@ -334,7 +334,7 @@ func Test_CombineBindingContext_Group_Type(t *testing.T) {
334334
}, labels)
335335
assert.Nil(t, buckets)
336336
})
337-
metricStorage.GaugeSetMock.Set(func(_ string, _ float64, _ map[string]string) {
337+
metricStorage.GaugeSetMock.Optional().Set(func(_ string, _ float64, _ map[string]string) {
338338
})
339339

340340
TaskQueues := queue.NewTaskQueueSet().WithMetricStorage(metricStorage)

pkg/task/dump/dump_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func Test_Dump(t *testing.T) {
9595
assert.Contains(t, mapSlice, labels)
9696
assert.Nil(t, buckets)
9797
})
98-
metricStorage.GaugeSetMock.Set(func(_ string, _ float64, _ map[string]string) {
98+
metricStorage.GaugeSetMock.Optional().Set(func(_ string, _ float64, _ map[string]string) {
9999
})
100100

101101
tqs := queue.NewTaskQueueSet().WithMetricStorage(metricStorage)

pkg/task/queue/task_counter.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,13 @@ func (tc *TaskCounter) Remove(task task.Task) {
7676

7777
counter, ok := tc.counter[id]
7878
if !ok {
79-
if _, reached := tc.reachedCap[id]; reached {
80-
delete(tc.reachedCap, id)
81-
}
79+
delete(tc.reachedCap, id)
8280
return
8381
}
8482

8583
if counter == 0 {
8684
delete(tc.counter, id)
87-
if _, reached := tc.reachedCap[id]; reached {
88-
delete(tc.reachedCap, id)
89-
}
85+
delete(tc.reachedCap, id)
9086
return
9187
}
9288

@@ -99,9 +95,7 @@ func (tc *TaskCounter) Remove(task task.Task) {
9995
}
10096

10197
if counter < compactionThreshold {
102-
if _, reached := tc.reachedCap[id]; reached {
103-
delete(tc.reachedCap, id)
104-
}
98+
delete(tc.reachedCap, id)
10599
}
106100
}
107101

0 commit comments

Comments
 (0)