mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +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
@ -47,7 +47,7 @@ func TestControllerServer_validateCreateVolumeGroupSnapshotRequest(t *testing.T)
|
||||
{
|
||||
"valid CreateVolumeGroupSnapshotRequest",
|
||||
args{
|
||||
context.Background(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
t.Context(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
Name: "vg-snap-1",
|
||||
SourceVolumeIds: []string{"vg-1"},
|
||||
Parameters: map[string]string{
|
||||
@ -62,7 +62,7 @@ func TestControllerServer_validateCreateVolumeGroupSnapshotRequest(t *testing.T)
|
||||
{
|
||||
"empty request name in CreateVolumeGroupSnapshotRequest",
|
||||
args{
|
||||
context.Background(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
t.Context(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
SourceVolumeIds: []string{"vg-1"},
|
||||
},
|
||||
},
|
||||
@ -72,7 +72,7 @@ func TestControllerServer_validateCreateVolumeGroupSnapshotRequest(t *testing.T)
|
||||
{
|
||||
"empty SourceVolumeIds in CreateVolumeGroupSnapshotRequest",
|
||||
args{
|
||||
context.Background(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
t.Context(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
Name: "vg-snap-1",
|
||||
SourceVolumeIds: []string{"vg-1"},
|
||||
},
|
||||
@ -83,7 +83,7 @@ func TestControllerServer_validateCreateVolumeGroupSnapshotRequest(t *testing.T)
|
||||
{
|
||||
"empty clusterID in CreateVolumeGroupSnapshotRequest",
|
||||
args{
|
||||
context.Background(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
t.Context(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
Name: "vg-snap-1",
|
||||
SourceVolumeIds: []string{"vg-1"},
|
||||
Parameters: map[string]string{"fsName": "value"},
|
||||
@ -95,7 +95,7 @@ func TestControllerServer_validateCreateVolumeGroupSnapshotRequest(t *testing.T)
|
||||
{
|
||||
"empty fsName in CreateVolumeGroupSnapshotRequest",
|
||||
args{
|
||||
context.Background(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
t.Context(), &csi.CreateVolumeGroupSnapshotRequest{
|
||||
Name: "vg-snap-1",
|
||||
SourceVolumeIds: []string{"vg-1"},
|
||||
Parameters: map[string]string{"clusterID": "value"},
|
||||
|
Reference in New Issue
Block a user