mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
build: address 'intrange' linter warning
golangci-lint warns about this: for loop can be changed to use an integer range (Go 1.22+) (intrange) Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
0e7b06e9d0
commit
e85914fc0d
@ -41,7 +41,7 @@ func TestFileChecker(t *testing.T) {
|
||||
t.Error("checker failed to start")
|
||||
}
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for range 10 {
|
||||
// check health, should be healthy
|
||||
healthy, msg := checker.isHealthy()
|
||||
if !healthy || msg != nil {
|
||||
|
@ -41,11 +41,11 @@ func TestStatChecker(t *testing.T) {
|
||||
t.Error("checker failed to start")
|
||||
}
|
||||
|
||||
for i := 0; i < 10; i++ {
|
||||
for i := range 10 {
|
||||
// check health, should be healthy
|
||||
healthy, msg := checker.isHealthy()
|
||||
if !healthy || msg != nil {
|
||||
t.Error("volume is unhealthy")
|
||||
t.Errorf("volume is unhealthy after %d tries", i+1)
|
||||
}
|
||||
|
||||
time.Sleep(time.Second)
|
||||
|
@ -210,7 +210,7 @@ func findDeviceMappingImage(ctx context.Context, pool, namespace, image string,
|
||||
|
||||
// Stat a path, if it doesn't exist, retry maxRetries times.
|
||||
func waitForPath(ctx context.Context, pool, namespace, image string, maxRetries int, useNbdDriver bool) (string, bool) {
|
||||
for i := 0; i < maxRetries; i++ {
|
||||
for i := range maxRetries {
|
||||
if i != 0 {
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ func TestStrategicActionOnLogFile(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
var logFile [3]string
|
||||
for i := 0; i < 3; i++ {
|
||||
for i := range 3 {
|
||||
f, err := os.CreateTemp(tmpDir, "rbd-*.log")
|
||||
if err != nil {
|
||||
t.Errorf("creating tempfile failed: %v", err)
|
||||
|
@ -244,7 +244,7 @@ func TestRTRemove(t *testing.T) {
|
||||
"ref3": reftype.Normal,
|
||||
}
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
for range 2 {
|
||||
created, err := Add(ioctx, rtName, refsToAdd)
|
||||
require.NoError(ts, err)
|
||||
require.True(ts, created)
|
||||
|
Reference in New Issue
Block a user