mirror of
https://github.com/prometheus/prometheus.git
synced 2025-09-21 13:51:00 +02:00
refactor: use slices.Equal to simplify code
Signed-off-by: MarkDaveny <peicuiping@aliyun.com>
This commit is contained in:
parent
7a7bc65237
commit
53be282396
@ -23,6 +23,7 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
@ -1156,12 +1157,7 @@ func requireTargets(
|
|||||||
}
|
}
|
||||||
sort.Strings(expectedTargets)
|
sort.Strings(expectedTargets)
|
||||||
sort.Strings(sTargets)
|
sort.Strings(sTargets)
|
||||||
for i, t := range sTargets {
|
return slices.Equal(sTargets, expectedTargets)
|
||||||
if t != expectedTargets[i] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}, 1*time.Second, 100*time.Millisecond)
|
}, 1*time.Second, 100*time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user