Skip to content

Commit d5e9199

Browse files
committed
add test-cases
1 parent 7b8985d commit d5e9199

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/integration/scheduler/queue_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ func TestCoreResourceEnqueue(t *testing.T) {
864864
enableSchedulingQueueHint: []bool{true},
865865
},
866866
{
867-
name: "Pod rejected with node by the VolumeZone plugin is requeued when the PVC is added",
867+
name: "Pod rejected with node by the VolumeZone plugin is requeued when the PVC bound to the pod is added",
868868
initialNodes: []*v1.Node{st.MakeNode().Name("fake-node").Label("node", "fake-node").Label(v1.LabelTopologyZone, "us-west1-a").Obj()},
869869
initialPVs: []*v1.PersistentVolume{
870870
st.MakePersistentVolume().
@@ -914,7 +914,7 @@ func TestCoreResourceEnqueue(t *testing.T) {
914914
enableSchedulingQueueHint: []bool{true},
915915
},
916916
{
917-
name: "Pod rejected with node by the VolumeZone plugin is requeued when the PVC is updated",
917+
name: "Pod rejected with node by the VolumeZone plugin is requeued when the PVC bound to the pod is updated",
918918
initialNodes: []*v1.Node{st.MakeNode().Name("fake-node").Label("node", "fake-node").Label(v1.LabelTopologyZone, "us-west1-a").Obj()},
919919
initialPVs: []*v1.PersistentVolume{
920920
st.MakePersistentVolume().
@@ -1018,7 +1018,7 @@ func TestCoreResourceEnqueue(t *testing.T) {
10181018
enableSchedulingQueueHint: []bool{true},
10191019
},
10201020
{
1021-
name: "Pod rejected with node by the VolumeZone plugin is not requeued when the unrelated label of PV is updated",
1021+
name: "Pod rejected with node by the VolumeZone plugin is not requeued when the unrelated PVC is added",
10221022
initialNodes: []*v1.Node{st.MakeNode().Name("fake-node").Label("node", "fake-node").Label(v1.LabelTopologyZone, "us-west1-a").Obj()},
10231023
initialPVs: []*v1.PersistentVolume{
10241024
st.MakePersistentVolume().
@@ -1058,13 +1058,14 @@ func TestCoreResourceEnqueue(t *testing.T) {
10581058
st.MakePod().Name("pod2").Container("image").PVC("pvc2").Obj(),
10591059
},
10601060
triggerFn: func(testCtx *testutils.TestContext) error {
1061-
pv2 := st.MakePersistentVolume().Name("pv2").Labels(map[string]string{v1.LabelTopologyZone: "us-east1"}).
1062-
AccessModes([]v1.PersistentVolumeAccessMode{v1.ReadOnlyMany}).
1063-
Capacity(v1.ResourceList{v1.ResourceStorage: resource.MustParse("1Mi")}).
1064-
HostPathVolumeSource(&v1.HostPathVolumeSource{Path: "/tmp", Type: &volType}).
1061+
pvc3 := st.MakePersistentVolumeClaim().
1062+
Name("pvc3").
1063+
Annotation(volume.AnnBindCompleted, "true").
1064+
AccessModes([]v1.PersistentVolumeAccessMode{v1.ReadWriteOncePod}).
1065+
Resources(v1.VolumeResourceRequirements{Requests: v1.ResourceList{v1.ResourceStorage: resource.MustParse("1Mi")}}).
10651066
Obj()
1066-
if _, err := testCtx.ClientSet.CoreV1().PersistentVolumes().Update(testCtx.Ctx, pv2, metav1.UpdateOptions{}); err != nil {
1067-
return fmt.Errorf("failed to update pv2: %w", err)
1067+
if _, err := testCtx.ClientSet.CoreV1().PersistentVolumeClaims(testCtx.NS.Name).Create(testCtx.Ctx, pvc3, metav1.CreateOptions{}); err != nil {
1068+
return fmt.Errorf("failed to create pvc3: %w", err)
10681069
}
10691070
return nil
10701071
},

0 commit comments

Comments
 (0)