@@ -762,7 +762,7 @@ func testVolumeProvision(t *testing.T, storageCapacity bool) {
762
762
}
763
763
764
764
run := func (t * testing.T , test testcaseType ) {
765
- // Create StorageClasses
765
+ t . Log ( "Creating StorageClass" )
766
766
suffix := rand .String (4 )
767
767
classes := map [string ]* storagev1.StorageClass {}
768
768
classes [classImmediate ] = makeDynamicProvisionerStorageClass (fmt .Sprintf ("immediate-%v" , suffix ), & modeImmediate , nil )
@@ -783,35 +783,43 @@ func testVolumeProvision(t *testing.T, storageCapacity bool) {
783
783
t .Fatalf ("Failed to create StorageClass %q: %v" , sc .Name , err )
784
784
}
785
785
}
786
- // Create PVs
786
+
787
+ t .Log ("Creating PVs" )
787
788
for _ , pvConfig := range test .pvs {
788
789
pv := makePV (pvConfig .name , classes [pvConfig .scName ].Name , pvConfig .preboundPVC , config .ns , pvConfig .node )
789
790
if _ , err := config .client .CoreV1 ().PersistentVolumes ().Create (context .TODO (), pv , metav1.CreateOptions {}); err != nil {
790
791
t .Fatalf ("Failed to create PersistentVolume %q: %v" , pv .Name , err )
791
792
}
793
+ if err := waitForPVPhase (config .client , pvConfig .name , v1 .VolumeAvailable ); err != nil {
794
+ t .Fatalf ("PersistentVolume %q failed to become available: %v" , pvConfig .name , err )
795
+ }
792
796
}
793
797
794
- // Create PVCs
798
+ t . Log ( "Creating PVCs" )
795
799
for _ , pvcConfig := range test .boundPvcs {
796
800
pvc := makePVC (pvcConfig .name , config .ns , & classes [pvcConfig .scName ].Name , pvcConfig .preboundPV )
797
801
if _ , err := config .client .CoreV1 ().PersistentVolumeClaims (config .ns ).Create (context .TODO (), pvc , metav1.CreateOptions {}); err != nil {
798
802
t .Fatalf ("Failed to create PersistentVolumeClaim %q: %v" , pvc .Name , err )
799
803
}
800
804
}
805
+
806
+ t .Log ("Creating unbound PVCs" )
801
807
for _ , pvcConfig := range test .unboundPvcs {
802
808
pvc := makePVC (pvcConfig .name , config .ns , & classes [pvcConfig .scName ].Name , pvcConfig .preboundPV )
803
809
if _ , err := config .client .CoreV1 ().PersistentVolumeClaims (config .ns ).Create (context .TODO (), pvc , metav1.CreateOptions {}); err != nil {
804
810
t .Fatalf ("Failed to create PersistentVolumeClaim %q: %v" , pvc .Name , err )
805
811
}
806
812
}
813
+
814
+ t .Log ("Creating unbound PVCs which should be dynamically provisioned" )
807
815
for _ , pvcConfig := range test .provisionedPvcs {
808
816
pvc := makePVC (pvcConfig .name , config .ns , & classes [pvcConfig .scName ].Name , pvcConfig .preboundPV )
809
817
if _ , err := config .client .CoreV1 ().PersistentVolumeClaims (config .ns ).Create (context .TODO (), pvc , metav1.CreateOptions {}); err != nil {
810
818
t .Fatalf ("Failed to create PersistentVolumeClaim %q: %v" , pvc .Name , err )
811
819
}
812
820
}
813
821
814
- // Create Pod
822
+ t . Log ( "Creating the pod to schedule" )
815
823
if _ , err := config .client .CoreV1 ().Pods (config .ns ).Create (context .TODO (), test .pod , metav1.CreateOptions {}); err != nil {
816
824
t .Fatalf ("Failed to create Pod %q: %v" , test .pod .Name , err )
817
825
}
@@ -825,7 +833,7 @@ func testVolumeProvision(t *testing.T, storageCapacity bool) {
825
833
}
826
834
}
827
835
828
- // Validate PVC/PV binding
836
+ t . Log ( "Validating PVC/PV binding" )
829
837
for _ , pvc := range test .boundPvcs {
830
838
validatePVCPhase (t , config .client , pvc .name , config .ns , v1 .ClaimBound , false )
831
839
}
@@ -840,6 +848,7 @@ func testVolumeProvision(t *testing.T, storageCapacity bool) {
840
848
}
841
849
842
850
// Force delete objects, but they still may not be immediately removed
851
+ t .Log ("Deleting test objects" )
843
852
deleteTestObjects (config .client , config .ns , deleteOption )
844
853
}
845
854
0 commit comments