Skip to content

Commit

Permalink
Fixed nil dereference in dynamic provisioning e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
verult committed Sep 20, 2017
1 parent d83c8bc commit fbeb07a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/e2e/storage/volume_provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,16 @@ func testDynamicProvisioning(t storageClassTest, client clientset.Interface, cla

// Check PV properties
By("checking the PV")
Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(Equal(*class.ReclaimPolicy))
expectedAccessModes := []v1.PersistentVolumeAccessMode{v1.ReadWriteOnce}
Expect(pv.Spec.AccessModes).To(Equal(expectedAccessModes))
Expect(pv.Spec.ClaimRef.Name).To(Equal(claim.ObjectMeta.Name))
Expect(pv.Spec.ClaimRef.Namespace).To(Equal(claim.ObjectMeta.Namespace))
Expect(pv.Spec.MountOptions).To(Equal(class.MountOptions))
if class == nil {
Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(Equal(v1.PersistentVolumeReclaimDelete))
} else {
Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(Equal(*class.ReclaimPolicy))
Expect(pv.Spec.MountOptions).To(Equal(class.MountOptions))
}

// Run the checker
if t.pvCheck != nil {
Expand Down

0 comments on commit fbeb07a

Please sign in to comment.