mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +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
@ -106,13 +106,12 @@ func TestControllerServer_validateCreateVolumeGroupSnapshotRequest(t *testing.T)
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
ts := tt
|
||||
t.Run(ts.name, func(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
err := cs.validateCreateVolumeGroupSnapshotRequest(ts.args.ctx, ts.args.req)
|
||||
if ts.wantErr {
|
||||
err := cs.validateCreateVolumeGroupSnapshotRequest(tt.args.ctx, tt.args.req)
|
||||
if tt.wantErr {
|
||||
c := status.Code(err)
|
||||
if c != ts.code {
|
||||
if c != tt.code {
|
||||
t.Errorf("ControllerServer.validateVolumeGroupSnapshotRequest() error = %v, want code %v", err, c)
|
||||
}
|
||||
}
|
||||
|
@ -143,28 +143,27 @@ func Test_setMountOptions(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()
|
||||
|
||||
driver := &csicommon.CSIDriver{}
|
||||
tc.ns.DefaultNodeServer = csicommon.NewDefaultNodeServer(
|
||||
tt.ns.DefaultNodeServer = csicommon.NewDefaultNodeServer(
|
||||
driver, "cephfs", "", map[string]string{}, map[string]string{},
|
||||
)
|
||||
|
||||
err := tc.ns.setMountOptions(tc.mnt, tc.volOptions, volCap, tmpConfPath)
|
||||
err := tt.ns.setMountOptions(tt.mnt, tt.volOptions, volCap, tmpConfPath)
|
||||
if err != nil {
|
||||
t.Errorf("setMountOptions() = %v", err)
|
||||
}
|
||||
|
||||
switch tc.mnt.(type) {
|
||||
switch tt.mnt.(type) {
|
||||
case *mounter.FuseMounter:
|
||||
if !strings.Contains(tc.volOptions.FuseMountOptions, tc.want) {
|
||||
t.Errorf("Set FuseMountOptions = %v Required FuseMountOptions = %v", tc.volOptions.FuseMountOptions, tc.want)
|
||||
if !strings.Contains(tt.volOptions.FuseMountOptions, tt.want) {
|
||||
t.Errorf("Set FuseMountOptions = %v Required FuseMountOptions = %v", tt.volOptions.FuseMountOptions, tt.want)
|
||||
}
|
||||
case mounter.KernelMounter:
|
||||
if !strings.Contains(tc.volOptions.KernelMountOptions, tc.want) {
|
||||
t.Errorf("Set KernelMountOptions = %v Required KernelMountOptions = %v", tc.volOptions.KernelMountOptions, tc.want)
|
||||
if !strings.Contains(tt.volOptions.KernelMountOptions, tt.want) {
|
||||
t.Errorf("Set KernelMountOptions = %v Required KernelMountOptions = %v", tt.volOptions.KernelMountOptions, tt.want)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -86,12 +86,11 @@ func TestIsVolumeCreateRO(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
newtt := tt
|
||||
t.Run(newtt.name, func(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
wantErr := IsVolumeCreateRO(newtt.caps)
|
||||
if wantErr != newtt.isRO {
|
||||
t.Errorf("isVolumeCreateRO() wantErr = %v, isRO %v", wantErr, newtt.isRO)
|
||||
wantErr := IsVolumeCreateRO(tt.caps)
|
||||
if wantErr != tt.isRO {
|
||||
t.Errorf("isVolumeCreateRO() wantErr = %v, isRO %v", wantErr, tt.isRO)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -209,13 +208,12 @@ func TestIsShallowVolumeSupported(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
newtt := tt
|
||||
t.Run(newtt.name, func(t *testing.T) {
|
||||
t.Log(newtt.args.req.GetVolumeContentSource().GetSnapshot())
|
||||
t.Log(IsVolumeCreateRO(newtt.args.req.GetVolumeCapabilities()))
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Log(tt.args.req.GetVolumeContentSource().GetSnapshot())
|
||||
t.Log(IsVolumeCreateRO(tt.args.req.GetVolumeCapabilities()))
|
||||
t.Parallel()
|
||||
if got := IsShallowVolumeSupported(newtt.args.req); got != newtt.want {
|
||||
t.Errorf("IsShallowVolumeSupported() = %v, want %v", got, newtt.want)
|
||||
if got := IsShallowVolumeSupported(tt.args.req); got != tt.want {
|
||||
t.Errorf("IsShallowVolumeSupported() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user