mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
build: address 'copyloopvar' linter warning
golangci-lint reports these: The copy of the 'for' variable "kmsID" can be deleted (Go 1.22+) (copyloopvar) Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
9321fe03c3
commit
0e7b06e9d0
@ -233,7 +233,6 @@ func TestGetCephClientLogFileName(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
val := getCephClientLogFileName(tt.args.id, tt.args.logDir, tt.args.prefix)
|
||||
@ -289,7 +288,6 @@ func TestStrategicActionOnLogFile(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
strategicActionOnLogFile(ctx, tt.args.logStrategy, tt.args.logFile)
|
||||
@ -337,8 +335,7 @@ func TestIsKrbdFeatureSupported(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tc := tt
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
var err error
|
||||
krbdSupportedFeaturesAttr := "0x1"
|
||||
@ -349,12 +346,12 @@ func TestIsKrbdFeatureSupported(t *testing.T) {
|
||||
// In case /sys/bus/rbd/supported_features is absent and we are
|
||||
// not in a position to prepare krbd feature attributes,
|
||||
// isKrbdFeatureSupported returns error ErrNotExist
|
||||
supported, err := isKrbdFeatureSupported(ctx, tc.featureName)
|
||||
supported, err := isKrbdFeatureSupported(ctx, tt.featureName)
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
t.Errorf("isKrbdFeatureSupported(%s) returned error: %v", tc.featureName, err)
|
||||
} else if supported != tc.isSupported {
|
||||
t.Errorf("isKrbdFeatureSupported(%s) returned error: %v", tt.featureName, err)
|
||||
} else if supported != tt.isSupported {
|
||||
t.Errorf("isKrbdFeatureSupported(%s) returned supported status, expected: %t, got: %t",
|
||||
tc.featureName, tc.isSupported, supported)
|
||||
tt.featureName, tt.isSupported, supported)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -382,11 +379,10 @@ func Test_checkValidImageFeatures(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tc := tt
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
if got := checkValidImageFeatures(tc.imageFeatures, tc.ok); got != tc.want {
|
||||
t.Errorf("checkValidImageFeatures() = %v, want %v", got, tc.want)
|
||||
if got := checkValidImageFeatures(tt.imageFeatures, tt.ok); got != tt.want {
|
||||
t.Errorf("checkValidImageFeatures() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user