Skip to content

Commit

Permalink
Avoid panic if creating volume from source fails
Browse files Browse the repository at this point in the history
If a driver advertises CREATE_DELETE_SNAPSHOT but fails to obey the
part of the spec about allowing CreateVolume from a snapshot (such as
during an incremental development of a driver), the testsuite was
panicking on a nil dereference instead of diagnosing that an
unexpected error was returned.

Fixes: kubernetes-csi#569
Signed-off-by: Eric Blake <[email protected]>
  • Loading branch information
ebblake committed Jan 20, 2025
1 parent 3ad33cb commit 66041d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/sanity/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,9 @@ var _ = DescribeSanity("Controller Service [Controller Server]", func(sc *TestCo
},
}
vol, err := r.CreateVolume(context.Background(), vol2Req)
Expect(vol.GetVolume().ContentSource).NotTo(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(vol).NotTo(BeNil())
Expect(vol.GetVolume().ContentSource).NotTo(BeNil())
})

It("should fail when the volume source snapshot is not found", func() {
Expand Down

0 comments on commit 66041d1

Please sign in to comment.