Skip to content

Commit c822096

Browse files
committed
Update to handle when no compute endpoint is passed
1 parent eda80f1 commit c822096

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cmd/gce-pd-csi-driver/main.go

+4
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ func urlFlag(target **url.URL, name string, usage string) {
244244
*target = computeURL
245245
return nil
246246
}
247+
if flagValue == "" {
248+
klog.Infof("No value recieved for %s", name)
249+
return nil
250+
}
247251
klog.Infof("Error parsing endpoint compute endpoint %v", err)
248252
return err
249253
})

test/e2e/tests/single_zone_e2e_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,14 @@ var _ = Describe("GCE PD CSI Driver", func() {
12951295

12961296
klog.Infof("Creating new driver and client for node %s\n", i.GetName())
12971297

1298+
tcEmpty, err := testutils.GCEClientAndDriverSetup(i, "")
1299+
if err != nil {
1300+
klog.Fatalf("Failed to set up Test Context for instance %v: %v", i.GetName(), err)
1301+
}
1302+
_, err = tcEmpty.Client.ListVolumes()
1303+
1304+
Expect(err).To(BeNil(), "no error expected when passed empty compute url")
1305+
12981306
// Create new driver and client w/ valid, passed-in endpoint
12991307
tcValid, err := testutils.GCEClientAndDriverSetup(i, "https://compute.googleapis.com")
13001308
if err != nil {

0 commit comments

Comments
 (0)