mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
cleanup: address golangci 'usetesting' linter issues
When a context.Context is needed in a unit test, t.Context() should be used instead of creating a new one with context.TODO() or context.Background(). Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
be5462cf62
commit
457ffe884a
@ -17,7 +17,6 @@ limitations under the License.
|
||||
package cephfs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/csi-addons/spec/lib/go/fence"
|
||||
@ -38,7 +37,7 @@ func TestFenceClusterNetwork(t *testing.T) {
|
||||
Cidrs: nil,
|
||||
}
|
||||
|
||||
_, err := controller.FenceClusterNetwork(context.TODO(), req)
|
||||
_, err := controller.FenceClusterNetwork(t.Context(), req)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
@ -54,6 +53,6 @@ func TestUnfenceClusterNetwork(t *testing.T) {
|
||||
Secrets: nil,
|
||||
Cidrs: nil,
|
||||
}
|
||||
_, err := controller.UnfenceClusterNetwork(context.TODO(), req)
|
||||
_, err := controller.UnfenceClusterNetwork(t.Context(), req)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user