Skip to content

Instantly share code, notes, and snippets.

@rootfs
Last active May 4, 2016 01:18
Show Gist options
  • Save rootfs/8c32b2edfbfb279d698f2fed7203dcac to your computer and use it in GitHub Desktop.
Save rootfs/8c32b2edfbfb279d698f2fed7203dcac to your computer and use it in GitHub Desktop.

RFC: Adding test cases to e2e/persistent_volumes.go

Existing test cases

e2e/persistent_volumes.go creates an NFS PV with recycle policy and an PVC to claim the PV. After the PVC is bound, it is deleted and PV is recycled.

Proposed test cases

Create Pod that uses multiple PVCs. Verify all PVCs are successfully bound and mounted.

  • Setup.
    • In the NFS server pod, creates 3 exports
    • Create 3 PVs, with sizes 1GB, 2GB, and 3GB, these PVs map to the 3 NFS exports
    • Create 3 PVCs, with claim sizes 1GB, 2GB, and 3GB.
    • Create a client Pod that uses the 3 PVCs
  • Expected Result. The client Pod should mount all NFS PVs, each PVCs are bound to the PVs with the matching size.

Create one PV and multiple PVCs. Verify exactly one PVC bound while other PVCs are pending.

  • Setup
    • Create 1 PVs with sizes 1GB
    • Create 3 PVCs, with claim sizes 1GB, 2GB, and 3GB.
  • Expected Result. 1GB PVC should be bound to the PV, 2GB and 3GB PVCs are pending.

Delete PVC and make sure PV changes to proper state given one of Recycle, Delete, and Retain policies defined in the PV.

Create PV with Delete policy

  • Setup
    • Create 1 PVs with sizes 1GB and Delete reclaim policy
    • Create 1 PVCs with claim sizes 1GB
    • Delete the PVC
  • Expected result. After PVC is deleted, PV is also deleted

Create PV with Retain policy

  • Setup
    • Create 1 PVs with sizes 1GB and Delete reclaim policy
    • Create a file on the PV
    • Create 1 PVCs with claim sizes 1GB
    • Delete the PVC
  • Expected result. After PVC is deleted, PV still exists and the file on the PV also exists

Create imbalanced access modes between PV and PVC. Eg. PV has RWO,RWX; but PVC has ROX.

  • Setup
  • Expected Result

And vice-versa where the claim has more modes than the PV. Test the that least permissive accessmode is matched.

  • Setup
  • Expected Result

Create a PVC that defines a specifiv PV (via volumeName) and make sure that PV is bound to the claim. Additionally, create PV1 with a claimRef -> claim1. Create claim1 with a volumeName -> PV2 (PV2 may or may not be created). Test that PV1 does not bind to claim1. Test that claim1 does not bind to PV1. @jeffvance please break down into sub tests

  • Setup.
    • create pv1 with reclaimPolicy=Retain
    • create claim1
      • test both are Bound
    • delete claim1
    • test pv1.status.Phase is Released.
    • re-create claim1
    • test pv1.status.Phase remains Released and claim1.status is Pending
    • delete claim1 and pv1
    • re-create pv1 and claim1
    • test both are Bound
    • create pv2 with claimRef -> claim2 and reclaimPolicy = Retain
    • create claim2
    • create claim2
    • test both are Bound
    • delete claim2
    • test pv2 status is Released
    • re-create claim2
    • test pv2 status remains Released and claim2 status is Pending
    • delete pv2 and claim2
    • re-create pv2 and claim2
    • test pv2 status remains Released and claim2 status is Pending.
  • Expected Result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment