lib/storage: add missing break in removeDuplicateMetricIDs

This commit is contained in:
Aliaksandr Valialkin 2019-09-25 18:23:13 +03:00
parent ea4c828bae
commit 2444433d83
2 changed files with 2 additions and 0 deletions

View File

@ -2343,6 +2343,7 @@ func removeDuplicateMetricIDs(sortedMetricIDs []uint64) []uint64 {
for _, metricID := range sortedMetricIDs[1:] {
if prevMetricID == metricID {
hasDuplicates = true
break
}
prevMetricID = metricID
}

View File

@ -26,6 +26,7 @@ func TestRemoveDuplicateMetricIDs(t *testing.T) {
f([]uint64{123}, []uint64{123})
f([]uint64{123, 123}, []uint64{123})
f([]uint64{123, 123, 123}, []uint64{123})
f([]uint64{123, 1234, 1235}, []uint64{123, 1234, 1235})
f([]uint64{0, 1, 1, 2}, []uint64{0, 1, 2})
f([]uint64{0, 0, 0, 1, 1, 2}, []uint64{0, 1, 2})
f([]uint64{0, 1, 1, 2, 2}, []uint64{0, 1, 2})