From e9e049b2129a225f0cd1553c932cc0455f987479 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 11 Nov 2024 16:22:49 +0900 Subject: [PATCH] fix: proper error handling and remove unnecessary variable definition Signed-off-by: hlts2 --- e2e/suite_test.go | 4 ++-- pkg/driver/controller_server.go | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/e2e/suite_test.go b/e2e/suite_test.go index b01bdd3..9bbb044 100644 --- a/e2e/suite_test.go +++ b/e2e/suite_test.go @@ -107,7 +107,7 @@ func TestMain(m *testing.M) { } controller.Spec.Template.Spec.Containers[3].Image = Image - e2eTest.tenantClient.Update(context.TODO(), controller) + err = e2eTest.tenantClient.Update(context.TODO(), controller) if err != nil { log.Panic(err) } @@ -120,7 +120,7 @@ func TestMain(m *testing.M) { log.Panic(err) } - e2eTest.tenantClient.Update(context.TODO(), csiDS) + err = e2eTest.tenantClient.Update(context.TODO(), csiDS) if err != nil { log.Panic(err) } diff --git a/pkg/driver/controller_server.go b/pkg/driver/controller_server.go index 0cad2af..58424d8 100644 --- a/pkg/driver/controller_server.go +++ b/pkg/driver/controller_server.go @@ -600,14 +600,12 @@ func (d *Driver) ListSnapshots(context.Context, *csi.ListSnapshotsRequest) (*csi } func getVolSizeInBytes(capRange *csi.CapacityRange) (int64, error) { - var bytes int64 - if capRange == nil { return int64(DefaultVolumeSizeGB) * BytesInGigabyte, nil } // Volumes can be of a flexible size, but they must specify one of the fields, so we'll use that - bytes = capRange.GetRequiredBytes() + bytes := capRange.GetRequiredBytes() if bytes == 0 { bytes = capRange.GetLimitBytes() }